Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the below class that could be used by a software to represent a general

ID: 3708820 • Letter: C

Question

Complete the below class that could be used by a software to represent a general Reservation package. The attributes and methods are described here:

Private Attributes:           reservationNumber(int)

HotelBrand(String)

price (double)

Public Methods:               

                  constructor: Receives values for the attributes as parameters and initializes them.

                  display: Displays the reservation information, including number,hotel, and price.

                  computeCost: This method takes an integer parameter to represent the number of people going staying in the hotel, and returns the computed cost using the number of people and price attribute.

- Extending the Reservation class

Complete the implementation for a class called Conference described below. The Conference class inherits the class Reservation and represents a more specific type of hotel package. It has additional attributes to include a list of parking ticket, as well as an attribute for conference fees.

The Conference class should have the following:

Conference class

Private Attributes:           parkingTicket (int):number of tickets

                                                      fees (double): fees for the Conference

Public Methods:

constructor: receives all Reservation and Conference attributes as parameters. This constructor initializes the conference attributes, and sends the appropriate variables to the super class constructor.

display: Displays the information in the Conference and Reservation classes. (We will need to call a method in the super class within this method.)

                  computeCost: This method takes an integer parameter for the number of people and computes the cost, which now includes the conference fees. (We will need to call a method in the super class within this method).

(C) Completing a main method Complete the main method in the below RunConference class to demo the 2 classes. Declare and initialize variables you will need to initialize a Conference object. Create an object of the Conference class and send the appropriate arguments to the constructor. Display the Conference information by calling the display method. Prompt the user to enter how many people will be going to the conference, and display the total cost in two decimal digits of precision “correct money format.

Explanation / Answer


Given below is the code for the question.
To indent code in eclipse , select code by pressing ctrl+a and then indent using ctrl+i
Please do rate the answer if it was helpful. Thank you

Reservation.java
--------

public class Reservation {
private int reservationNumber;
private String hotelBrand;
private double price;

public Reservation(int reservationNumber, String hotelBrand, double price) {
this.reservationNumber = reservationNumber;
this.hotelBrand = hotelBrand;
this.price = price;
}

public double computeCost(int numPeople)
{
return numPeople * price;
}

public void display()
{
System.out.println("Reservation number: " + reservationNumber);
System.out.println("Hotel Brand: " + hotelBrand);
System.out.printf("Reservation Price: $%.2f " , price);
}


}


Conference.java
--------------

public class Conference extends Reservation {
private int parkingTicket;
private double fees;


public Conference(int reservationNumber, String hotelBrand, double price, int parkingTicket, double fees) {
super(reservationNumber, hotelBrand, price);
this.parkingTicket = parkingTicket;
this.fees = fees;
}


@Override
public void display()
{
super.display();
System.out.println("Parking Ticket: " + parkingTicket);
System.out.printf("Conference Fees: $%.2f ", fees);
}


@Override
public double computeCost(int numPeople)
{
return super.computeCost(numPeople) + numPeople * fees;
}
}


RunConference.java
----------
import java.util.Scanner;

public class RunConference {
public static void main(String[] args) {
Conference conf = new Conference(123, "Hyatt Regency", 80, 3, 2195);
System.out.println("Conference details");
conf.display();


Scanner keyboard = new Scanner(System.in);
System.out.print(" How many people? ");
int numPeople = keyboard.nextInt();
System.out.printf("Total cost: $%.2f ", conf.computeCost(numPeople));

}
}


output
=====
Conference details
Reservation number: 123
Hotel Brand: Hyatt Regency
Reservation Price: $80.00
Parking Ticket: 3
Conference Fees: $2195.00

How many people? 4
Total cost: $9100.00

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote