Create a class called RoomInfo:
Need to have the following private variables for class:
Need to have following functions for class:
Properties for each variables
calcRoomSize: this function calculate the room size and update the house size.
Create a class called RoomInfoDemo.
1. main function:
create four different room objects
call getData function for each room
Display room and house size
Display number of rooms have TV
- getData function:
pass the object into this function via parameter
prompt user to enter the length and width
prompt user to enter: ‘Y’ if there is a TV in the room or ‘N’ if there is none, and save the
result in the “hasTV” variable.