a. Write a parameter constructor for this class. The constructor should accept 4
ID: 3795535 • Letter: A
Question
a. Write a parameter constructor for this class. The constructor should accept 4 parameters for the subject, classSession, roomNumber and instructorID
b. Write accessor and mutator methods for each field
c. Draw a UML diagram for the class ClassRoom (you can use table 1column x 3 rows of Microsoft Word document to draw UML. Learn how to write information in UML before do this question)
2. Question 2 Look at the following partial class definition, and then respond to the questions a, b and c public class ClassRoom private String subject; private String classSession; private String roomNumber; private String instructorID;Explanation / Answer
A)Constructor for above program is
Constructor name should be same as that of class name
// parameterized constructor is
Classroom(string subject,string classsession,string roomnumber,string instructorid)
{
//your content
}
B)
//Accessor for subject
Public String getsubject()
{
return subject;
}
//Accessor for classsession,roomnumber,instructorid
Public String getclasssession()
{
return classsession;
}
Public String getroomnumber()
{
return roomnumber;
}
Public String getinstructorid()
{
return instructorid();
}
//Mutators for all 4 fields
Public void setsubject()
{
this.subject= subject;
}
Public void setclasssession()
{
this.classsession= classsession;
}
Public void setroomnumber()
{
this.roomnumber= roomnumber;
}
Public void setinstructorid()
{
this.instructorid= instructorid();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.