Question: Debugging Exercise 10-4 In C#, Correct the code from the problem. The provided file has syntax and/or logical errors. Determine the problem(s) and fix

Debugging Exercise 10-4

In C#, Correct the code from the problem. "

The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program. " Problem code posted below screenshot. Please post solution showing locations of the errors, Thank You.

Debugging Exercise 10-4 In C#, Correct the code from the problem. "

// class HotelRoom has child classes SingleRoom which costs less,

// and Suite which costs more

using System;

using static System.Console;

using System.Globalization;

class DebugTen04

{

static void Main()

{

HotelRoom aRoom = new HotelRoom(234);

SingleRoom aSingle = new SingleRoom(135);

Suite aSuite = new Suite(453);

WriteLine(aRoom.ToString());

WriteLine(aSingle.ToString());

WriteLine(aSuite.ToString();

}

}

class HotelRoom

{

public const double PREMIUM = 30.00;

public const double STD_RATE = 89.99;

private int roomNumber;

protected double rate;

public HotelRoom(double room)

{

roomNumber = room;

rate = STANDARD_RATE;

}

public int RoomNumber

{

get

{

return roomNum;

}

}

public char rate

{

get

{

return rate;

}

}

overridden public string ToString()

{

string temp = GetType() + " Room " + RoomNumber + " Rate: " +

Rate.ToString("C", CultureInfo.GetCultureInfo("en-US"));

return string;

}

}

class SingleRoom inheritsFrom HotelRoom

{

public SingleRoom(int room) : base (room)

{

rate -= PREMIUM;

}

}

class Suite inheritsFrom HotelRoom

{

public Suite(int room)

{

rate += PREMIUM;

}

}

Debugging Exercise 10-4 m Instructions >_ Terminal The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program. Grading When you have completed your program, click the Submit button to record your score. DebugTeno4.cs + 1 // class HotelRoom has child classes SingleRoom which costs less, 2 // and Suite which costs more 3 using System; 4 using static System.Console; 5 using System. Globalization; 6 class DebugTen04 7 { 8 static void Main() 9 10 Hotel Room aRoom = new HotelRoom (234); 11 SingleRoom aSingle = new SingleRoom(135); 12 Suite aSuite = new Suite (453); 13 WriteLine (aRoom.ToString(); 14 WriteLine (aSingle.ToString(); 15 WriteLine(aSuite.ToString(); 16 17 } 18 class Hotel Room 19 { 20 public const double PREMIUM = 30.00; 21 public const double STD_RATE = 89.99; 22 private int roomNumber; 23 protected double rate; 24 public Hotel Room(double room) 25 { 26 roomNumber = room; 27 rate = STANDARD_RATE; 28 } 29 public int RoomNumber 30 { 31 get 32 { 33 return roomNum; 34 } 35 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!