Write a program that utilizes a Professor class. A professor has a first name, last name, affiliation, easiness grade, and a helpfulness grade. Grades range from 1 (lowest) to 5 (highest). The Professor class has two constructors. The first constructor initiates the object with just the first name, the last name, and the affiliation. The default value for easiness and helpfulness grade is 3. The second constructor initiates the object using the first name, the last name, the affiliation, and two grades.
The Professor class must not allow a first name or last name to be changed after instantiation.
The affiliation should be implemented as a property.
The grades should have both an accessor method and a mutator method. The Professor class should have a display method that prints all member variables in an appropriate format. For example, you can print out the first name, the last name, affiliation, and the two grades from the display method.
The Professor class should have a ToString() method. Make sure to override the ToString() method to present something meaningful.
Lastly, you should use the Main() method to demonstrate how the Professor class works. For example, create an instance of the Professor class with one of its two constructors. And then, invoke the display method on the instance.
Were using Visual Studios C# console.
I am stuck on how to get started and begin this program.
public class Professor{
String FirstName;
String LastName;
String affiliation;
int EasinessGrade=3;
int HelpfullnessGrade=3;
Professor(String FName, String LName, String aff){
this.FirstName=FName;
this.LatNAme=LName;
this.affiliation=aff;
}
Professor(String FName, String LName, String aff, int EGrade, int
HGrade){
this.FirstName=FName;
this.LastName=LName;
this.affiliation=getAff(aff);
setEasyGrade(EGrade);
this.EasinessGrade=getEasyGrade();
setHelpGrade(HGrade);
this.HelpfullnessGrade=getHelpGrade();
}
public String getAff(aff){
return aff;
}
public void setEasyGrade(EGrade){
this.EasinessGrade=EGrade;
}
public int getEasyGrade(){
return EasinessGrade;
}
public void setHelpGrade(HGrade){
this.HelpfullnessGrade=HGrade;
}
public int getHelpGrade(){
return HelpfullnessGrade;
}
public void display(){
System.out.println("First Name : "+FirstName);
System.out.println("Last Name : "+LastName);
System.out.println("Affiliation : "+affiliation);
System.out.println("EasinessGrade : "+EasinessGrade);
System.out.println("HelpfullnessGrade : "+HelpfullnessGrade);
}
public static void main(String []args){
Professor p=new Professor("Manan","Arora","Assistant
Professor",5,5);
p.display();
}
}
Get Answers For Free
Most questions answered within 1 hours.