60 426
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #59506 in C# for Lekorius Wallace

Question #59506
Write a program in which you declare a class HotelRoom. The class has the fol- lowing private instance variables: the room number (a string), the room capacity (an integer representing the maximum number of people the room can accom- modate), the occupancy status (an integer, 0 if the room is not occupied, other- wise the number of occupants in the room), and the daily rate (a double). Include a three-argument constructor that sets the room number to its first argument, the room capacity to the second argument, the room rate to the third argument, and that sets the room occupancy status to 0. Compile and test the program. Note: We will continue this exercise in the next section.
Expert's answer
using System;

namespace HotelRoom
{
class HotelRoom
{
string room_number;
int room_capacity;
int occupancy_status;
double daily_rate;

public HotelRoom(string room_num, int room_cap, double daily_ra, int occup_stat = 0)
{
room_number = room_num;
room_capacity = room_cap;
daily_rate = daily_ra;
occupancy_status = occup_stat;
}
}
}


using System;

namespace HotelRoom
{
class Program
{
static void Main(string[] args)
{
HotelRoom hr101 = new HotelRoom("101", 4, 200);
HotelRoom hr102 = new HotelRoom("102", 2, 100.75, 2);
}
}
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions