Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need another method for the following java code : /** * class RoomReservation inherates from Reservation * */ public class RoomReservation extends Reservation {

I need another method for the following java code :

/** * class RoomReservation inherates from Reservation * */ public class RoomReservation extends Reservation { //instatnce variables private String requirements; private String reservationType; private int nightsNumber; private double nightPrice; private double RATE; private double cost; private static int counter = 0; private int ID; /** * * @param ID as id of the customer * @param reservationType as type of reservation(c or r) * @param nightsNumber as number of nights to stay * @param RATE as rate to calculate the cost * @param nightPrice as a price of each night * @param requirements as other requairemnt such as coffemaker */ public RoomReservation(int ID, String reservationType, int nightsNumber, double RATE ,double nightPrice, String requirements) { super(ID, reservationType, nightsNumber,RATE, nightPrice); this.requirements = requirements; } /** * toString to convert the info and prints them all * @return info of the reservation */ public String toString() { return String.format(super.toString()+" with requirements: "+requirements); } }

+++++++++++++++++++++++++++++++++++++++++++++++++++

/** * * @author ConferenceReservation inherates from Reservation * */

public class ConferenceReservation extends Reservation { //instance variables private int numOfGuests; private double costOfConference; /** * * * @param ID as id of reservation * @param reservationType as type of (room or conference) * @param nightsNumber of number of nights * @param RATE rate of coference * @param numOfGuests as num of guests * @param nightPrice as price for one night */ public ConferenceReservation(int ID, String reservationType, int nightsNumber, double RATE,double nightPrice, int numOfGuests) { super(ID, reservationType, nightsNumber,RATE, nightPrice); this.numOfGuests = numOfGuests; } /** * calculate the cost for conference * @return costOfConference */ public double conCost(){ return costOfConference=(numOfGuests*nightsNumber*MusandamResort.conferencePrice)-RATE*(numOfGuests*nightsNumber*MusandamResort.conferencePrice); } @Override public String toString() { return super.toString()+" with no. of guests: "+numOfGuests; } }

+++++++++++++++++++++++++++++++++++++++++

/** * * @author dell */ public class Reservation { private String reservationType; int nightsNumber; double nightPrice; double RATE; private double cost; private static int counter = 0; static int ID; public Reservation(int ID, String reservationType, int nightsNumber,double RATE, double nightPrice) { this.ID = counter; counter=counter+1; this.reservationType = reservationType; this.nightsNumber = nightsNumber; this.RATE = RATE; this.nightPrice = nightPrice;

} public String getType() { return reservationType; } public int getNumOfNights() { return nightsNumber; } public double getRate() { return RATE; } public double getNightPrice() { return nightPrice; } public double getCalculateCost(int nightsNumber, double nightPrice, double RATE) { return cost = (nightsNumber * MusandamResort.roomPrice) - RATE * (nightsNumber * nightPrice); } public double getID() { return ID; }

@Override public String toString() { return String.format("%10d%10s%10d%10s", ID , reservationType , nightsNumber , cost); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe the limbic systems structures and functions.

Answered: 1 week ago