The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 364 Weeks Ago, 4 Days Ago |
| Questions Answered: | 1850 |
| Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
hello
I am 3 weeks into my java cop 2230 and i need some help calculating a bill for a hotel. here are  the numbers to the testhotel
Â
ABC Cheap Lodging, Inc
Rates Table
ROOM ..................$79.95 (per person)
TAX .....................6.5% (applies to room cost only)
TELEPHONE .......... $5.75 (Flat rate)
MEAL .................. $ 12.95 (per person, per day)
TIP ......................7.5% (cover all charges)
I have to use the class HotelÂ
add the necessary codes (variables and methods) to add more nights and more customers.
Use the test class TestHotel and complete the definition for the overloaded method display that prints theÂ
summary report You determine and define the variables and methods necessary in the Hotel class that will beÂ
used for the summary report.
so far i have this.... Â can someone help me with this????
Â
import java.util.Scanner;
import java.text.DateFormat;
import java.text.NumberFormat;
class TestHotel
{
public static void main(String[] arg)
{
//Declare variables ]
Scanner scanner = new Scanner (System.in);
NumberFormat f = NumberFormat.getCurrencyInstance();
// Create customer objects, calculate amounts, display receipts
hotel customer1 = new hotel("10 - M", 2, 2);
customer1.calculate();
display(customer1, f);
hotel customer2 = new hotel("12 - B");
hotel customer3 = new hotel("12 - C", 2);
customer3.calculate();
customer2.addNights(1);
customer2.calculate();
display(customer2, f);
customer3.addGuest(1);
customer3.calculate();
display(customer3, f);
display(f);
}
static void display(hotel h, NumberFormat f)
{
// Set up and display heading and date for each receipt
System.out.println("tThe ABC Cheap Lodging, Inc");
Date d = new Date();
DateFormat df = DateFormat.getDateInstance();
System.out.println("tDate: t" + df.format(d));
// Display expenses line by line including subtotal
System.out.println("Room# ttt" + h.getRoomNumber());
System.out.println("Room Ratettt" + f.format(h.getRoomRate()));
System.out.println("Length of staytt" + h.getNumberOfNights() + " night(s)");
System.out.println("No. of gueststt" + h.getNumberOfGuests());
System.out.println("Room costttt" + f.format(h.getAmountDue()));
System.out.println("Tax" + h.getTaxRate() + "%tttt" + f.format(h.getTaxDue()));
System.out.println("tSubtotal ttt" + f.format(h.getSubtotal()));
System.out.println("Telephone ttt" + f.format(h.getPhoneCharges()));
System.out.println("Meal charges tt" + f.format(h.getMeal()));
System.out.println("Tip tttt" + f.format(h.getTipDue()));
//Display to total
System.out.println("nTOTAL AMOUNT DUEt.........." + f.format(h.getTotal()));
// Display thank you message
System.out.println("nThanks for staying at The ABC Cheap Lodging, Inc" );
System.out.println("tPlease come again !!!");
System.out.println("n");
System.out.println("tToday's Summary "+ f.format(h.getSummaryTotal()));
}
static void display( NumberFormat f)
{
// Complete this method so that it displays the summary amounts as shown in the output
System.out.println("tOfficial Use Only");
System.out.println("n");
}
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I