Hi Guys,
I get an error while compiling my tester class.
Can someone help me ?
my code is below with comments for your attention
public class Course { //Main Java Class **************************************
// ****************************************************************************
private String CourseName,setName,getName;
private int ModuleCode,Students,CourseDetails,Duration,setCode,setStudents;
private int setDetails,setDuration,getStudents,getDetails,getDuration,getCode;
private float HoursPerWeek,setHours,getTotalHours,getCost,getHours;
//Constructors ****************************************************************
public Course(String name, int code){
CourseName = name;
ModuleCode = code;
}
public Course(int number, int details){
Students = number;
CourseDetails = details;
}
public Course(float hours, int time){
HoursPerWeek = hours;
Duration = time;
}
//Transformares ***************************************************************
public void setName(String name){
setName = name;
}
public void setCode(int code){
setCode = code;
}
public void setStudents(int number){
setStudents = number;
}
public void setDetails(int details){
setDetails = details;
}
public void setHours(float hours){
setHours = hours;
}
public void setDuration(int time){
setDuration = time;
}
//Calculate total hours *******************************************************
public float calculateTotalHours(){
return ((HoursPerWeek+Duration));
}
//Calculate course cost for staff *********************************************
public double calculateCost(){
return ((getCost-14.52));
}
//Accessors *******************************************************************
public float getTotalHours(){
return HoursPerWeek+Duration;
}
public float getCost(){
return getCost;
}
public String getName(){
return CourseName;
}
public int getCode(){
return ModuleCode;
}
public int getStudents(){
return Students;
}
public int getDetails(){
return CourseDetails;
}
public float getHours(){
return HoursPerWeek;
}
public int getDuration(){
return Duration;
}
} //Close class ***************************************************************
Tester Class Below:
public class CourseTest
{
public static void main( String[] args){
Course coursename1 = new Course("NQ Computing");
Course modulecode1 = new Course("DH356");
Course students1 = new Course("20");
Course coursedetails1 = new Course("This course is designed for students who want to progress to HNC and HND in computing");
Course hoursperweek1 = new Course("21");
Course duration1 = new Course("1 Year");
System.out.println("Name 1 "+coursename1.getName()+" Code 1"+modulecode1.getCode());
System.out.println("Number 1"+students1.getStudents()+" Details 1"+coursedetails1.getDetails());
System.out.println("Hours 1 "+hoursperweek1.getHours()+"Time 1"+duration1.getDuration());
System.out.println("Total hours = "+hoursperweek1.getHours()+"duration1.getDuration()");
System.out.println ("Course cost for staff =+getCost-14.52");
}
}
Compiler error below:
Course hoursperweek1 = new Course("21");
C:\Course\src\CourseTest.java:18: cannot find symbol
symbol : constructor Course(java.lang.String)
location: class Course
Course duration1 = new Course("1 Year");
6 errors
BUILD FAILED (total time: 1 second)
Enter your message below
Sign in or Join us (it's free).