Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java coding, can you help me in this Project 4 Welcome to our BUFFET Write a program for a Buffet to display the bill for

Java coding, can you help me in this

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Project 4 Welcome to our BUFFET Write a program for a Buffet to display the bill for the cashier. The buffet serves a chef's menu with two options Category Price Adjustment Adults $31.50 The total adult bill is reduced by $5.00 if there are 9 or more adults. Children $15.00 It is free after the third child (you pay maximum of 3 children) The program requests the name and zip code of the buffet and converts the text. The program then accepts the number of adults and children, performs the necessary calculations, computes the 6% tax, and displays the bill. Follow the formatting of the example below. Enter name of Buffet: moNet Enter zip code: 21237 Enter number of adults (-1 to stop) . . 9 Enter number of children. ... 4 Monet Buffet Rosedale All you can eat Buffet at a great price! ! ! Price Total Adults $31. 50 $278. 50 Children $15.00 $45.00 Subtotal $323. 50 Tax (6%) $19. 41 Total bill $342. 91 Enter number of adults (-1 to stop) . . BuffetDemo should follow this sequence: Request the name and zip code of the buffet from the user. Use the Buffet class to set the buffet name and the location but do not display it. You will display the buffet information in the while loop with the other output. Project Four Page 1The while loop: Requests the number of meals for adults and children. Uses the Bill class to instantiate these objects: adultBill child Bill Uses the Bill class to calculate the adult and child costs. Uses the Bill class to calculate the tax. The call should look like this: ??? = Bill.caleTax(???); Totals the costs. Displays the buffet name and location created earlier using the Buffet class - use the toString method (the title of the bill) Displays the two lines showing the adult and child costs using the Bill class - use the display method. Displays the subtotal of the bill. Displays the tax. Use Bill.TAXRATE to get the current tax rate (6%) from the Bill class and format the value as percentage. Displays the total of the bill. You will be coding two classes: Buffet and Bill. The Buffer Class Buffet has these instance variables String name String location The constructor (assigns the returned value from the setters to the properties): Call the setName method to assign a value to name, using the value passed to it (the name of the buffet as entered by the user.) Call the setLocation method to assign a value to location, using the value passed to it (the zip code as entered by the user.) Zip code must be an integer. Buffet contains these methods. Project Four Page 2setName method changes the name entered by the user so that the first character is uppercase, the rest of the characters are lower case, and " Buffet" is attached. This method returns a string. setLocation method uses the zip code entered by the user to determine the location. Concatenate the underline using the "-" character; the underline must be the same size as the location. In addition, add the following line: "All you can eat Buffet at a great price!!!". This method returns the concatenated string Use a nested if or switch Zip Code Location 21204 Towson 21237 Rosedale Any other value Baltimore toString method returns a string that displays the first four lines of the receipt. Here is an example of possible output: Monet Buffet Rosedale All you can eat Buffet at a great price! ! ! The Bill Class Set up a final for the tax rate like this: static final double TAXRATE = .06; Bill has these instance variables: String category int mealQty double mealCost double mealPrice The constructor: category will be set to null. mealQty will be passed the number of meals ordered for the category. mealCost will be initialized to 0. mealPrice will be initialized to 0. Bill contains these methods. Project Four Page 3calcAdultCost sets the category to "Adults", calculates the cost of the adult meals, sets the mealPrice, and sets and returns the mealCost. calcChildCost sets the category to "Children", calculates the cost of the children's meals, sets the mealPrice, and sets and returns the mealCost. caleTax calculates the tax. Return the calculated tax based on the total sent to this method. Set up the method like this: static double calcTax(double total) display displays the category, mealQty, mealPrice, and mealCost. Format the number accordingly using the currency format. The method header looks like this: public void display() You will be submitting 3 java files. Any class, variable or method names in bold must be used in your program. Grading: BuffetDemo Class (20 points) Buffet Class (15 points) Bill Class (15 points) Testing and Accuracy (5 points) Project Four Page 4

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions