Question: Answer the following questions with class definition (object) defined below: class Room { private String my_roomName; private int desiredTemp; // desired temperature setting private int
- Answer the following questions with class definition (object) defined below:
class Room {
private String my_roomName;
private int desiredTemp; // desired temperature setting
private int actualTemp; // actual temperature setting
Room( );
Room(String room_name);
public void set_desiredTemp (int newTemp) { // set the desired Temp }
public void set_actualTemp (int actTemp) { // set the actual Temp }
public int getDesiredTemp( ) { // returns the desired temperature setting }
public int getActualTemp( ) { // returns the actual temperature setting }
}
- What is the name of the class?
- Name all methods except for the constructors.
- How many class data declarations are there?
- getActualTemp ( ) method returns what data type?
- Construct an object data type named kitchen that has a room name of kitchen
- Write statement(s) that will set the desired temperature to 75 degrees for the kitchen.
- Write statement(s) that will display the room's (kitchen) desired temperature.
- Write statement(s) that will display the room's (kitchen) actual temperature.
- Write statement that will create 100 references for Room object.
Step by Step Solution
There are 3 Steps involved in it
The name of the class is Room Methods excluding constructors setdesiredTemp setactualTemp getDesire... View full answer
Get step-by-step solutions from verified subject matter experts
