hello. Am having a hard time intepreting this java error. The last post made somethings clear but I dont know what am missing. I am getting the error "cannot find symbol construtor Student(java.lang.String, java.lang.String,char,boolean,int,int)"

Iam getting the error on this line of code

Student studentObj1=new Student("mark","251461",'m',false,3,5);

Here is the class Student

class Student{
	
	private String name;
	private String SSN;
	private char gender;
	private boolean isFullTime;
	private Course course1;
	private Course course2;
	
	public Student(){
		name="n/a";
		SSN="n/a";
		gender='n';
		course1=null;
		course2=null;
		isFullTime=false;
	}
	
	public Student(String name, String SSN, char gender,boolean isFullTime, Course course1,Course course2)
	{
		this.name=name;
		this.SSN=SSN;
		this.gender=gender;
		this.isFullTime=isFullTime;
		this.course1=course1;
		this.course2=course2;
	}
	
	private String getGender()
	{
		if(gender=='m' || gender=='M')
		{
			return "Male";
		}
		
		else if (gender=='f'||gender=='F')
		{
			return "Female";
		}
		
		else return "n/a";
	}
	
	private int getTotalCredits()
	{
		int sum=0;
		
		if ((course1==null) && (course2==null))
		{
			return 0;
		}
		
		else
		{
			sum=course1.getCredits()+course2.getCredits();
			return sum;
		}
	}
	
	public void printStudentInfo()
	{
		System.out.println("Student Name:"+name);
		System.out.println("SSN:"+SSN);
		System.out.println("Gender:"+getGender());
		
		if (isFullTime)
		{
			System.out.println("Full Time");	
		}
		
		else 
		{
			System.out.println("Part Time");
		}
		
		if(course1==null||course2==null)
		{
			System.out.println("Course Not available:");
		}
		
		else	
		course1.getCredits();
		
		System.out.println("Total Number of credits:"+getTotalCredits());
	
	}
}

here is how i call to display

studentObj1.printStudentInfo();

Recommended Answers

All 2 Replies

Look at your constructors. You have a constructor that takes as arguments

String, String, char, boolean, Course, Course

but you are calling the constructor with

String, String, char, boolean, int, int

See the problem?

commented: What Problem ;) +8

got it..thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.