Cash-back offer from May 7th to 12th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 16.00

Project 3 The Cafe Problem complete solutions correct answers key

Question posted by
Online Tutor Profile
request

Project 3 The Cafe Problem complete solutions correct answers key

 

Project 3 The Cafe Problem

Write a program for a cafe to display the bill for the cashier. The cafe serves a chef’s menu with two options Category

Price

Adjustment

Adults

$31.50

The total adult bill is reduced by $4.00 if there are 8 or more adults.

Children

$15.00

 

 The program requests the identification number for the cafe and the starting order number. The program then accepts the number of adults and children, performs the necessary calculations, computes the 6% tax, and displays the bill similar to the example below.

Enter cafe identifier: 252

Enter first order number: 100

Enter number of adults (-1 to stop).....8

Enter number of children................2

White Marsh Cafe

Order Number = 100

Price Total

Adults 8 31.50 248.00

Children 2 15.00 30.00

Tax (6%) 16.68

Total bill 294.68

Enter number of adults (-1 to stop).....

main should follow this sequence:

Request the identification number for the cafe and the starting order number from the user.

Use the Cafe class to set up the cafe name but do not display it.

You will display the cafe name and order number in the while loop with the other output.

The while loop (adults is the sentinel value so get the value once before the loop and once at the end of the loop):

Requests the number of meals for adults and children.

Uses the Bill class to instantiate these objects:

adultBill

childBill

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.calcTax(???);

Totals the costs.

Displays the cafe name and order number created earlier using the Cafe class

– use the toString method.

Displays the two lines showing the adult and child costs using the Bill class

– use the display method.

Displays the tax. Use Bill.TAXRATE to get the current tax rate (6%) from the Bill class.

Displays the total cost.

You will be coding two classes: Cafe and Bill.

The Cafe Class – write and test one method at a time.

Cafe has these instance variables in the constructor:

String cafeID is assigned the value passed to it (the cafe identification number entered by the user in main).

Integer orderNum is assigned the value passed to it (the starting order number entered by the user in main).

String cafeName is assigned null.

Cafe contains these methods.

setName method uses cafeID to determine the café name. This method returns a string. Use a nested if or switch.

Cafe ID

Cafe Name

101

Essex Cafe

252

White Marsh Cafe

Any other value

Towson Cafe

The Bill Class

Set up a final for the tax rate like this:

static final double TAXRATE = .06;

Bill has these instance variables in the constructor:

String category will be set to null.

int mealQty will be passed the number of meals ordered for the category.

double mealCost will be initialized to 0.

double mealPrice will be initialized to 0.

Bill contains these methods.

calcAdultCost 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.

calcTax 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. Use one printf similar to this:

System.out.printf( "\n %-10s %3d %6.2f %7.2f",

category, mealQty, mealPrice, mealCost);

You can copy/paste the above code into the display method.

The method header looks like this:

public void display()

You will be submitting 3 java files for the final version. Any class, variable or method names in bold must be used in your program.

Project Points – Check Schedule for due dates.

What to include

Project 3 – Part I (30 points)

Submit a UML diagram for the Cafe class.

Submit the Cafe class code.

Do not submit your main code. A class should work with any main so I will test it with my main. You should, however, code main so you can test the Cafe class as well as the rest of the requirements.

Project 3 - Final Version

(100 points)

Final Version of main, Cafe and Bill classes

Here is the pseudocode for main to test your Cafe class required for Part I:

 get cafe id

 get order number

 instantiate the object (tests the Cafe constructor)

 call setName (tests the setName method)

 print object name (tests the toString method)

 

When this code works then add the while loop to main to test that the order number increases.

 get cafe id

 get order number

 instantiate the object (tests the Cafe constructor)

 call setName (tests the setName method)

 get adults

 

while(adults != -1)

{

 print object name (tests the toString method)

 get adults

 

}

Available Answer
$ 16.00

[Solved] Project 3 The Cafe Problem complete solutions correct answers key

  • This solution is not purchased yet.
  • Submitted On 12 Jan, 2017 03:06:23
Answer posted by
Online Tutor Profile
solution
Project 3 The Cafe Problem complete solutions correct answers key Project 3 The Cafe Problem Write a program for a cafe to display the bill for the cashier. The cafe serves a chef’s menu with two options Category Price Adjustment Adults $31.50 The total adult bill is reduced by $4.00 if there are 8 or more adults. Children $15.00 The program requests the identification number for the cafe and the starting order number. The program then accepts the number of adults and children, performs the necessary calculations, computes the 6% tax, and displays the bill similar to the example below. Enter cafe identifier: 252 Enter first order number: 100 Enter number of adults (-1 to stop).....8 Enter number of children................2 White Marsh Cafe Order Number = 100 Price Total Adults 8 31.50 248.00 Children 2 15.00 30.00 Tax (6%) 16.68 Total bill 294.68 Enter number of adults (-1 to stop)..... main should follow this sequence: Request the identification number for the cafe and the starting order number from the user. Use the Cafe class to set up the cafe name but do not display it. You will display the cafe name and order number in the while loop with the other output. The while loop (adults is the sen...
Buy now to view the complete solution
attachment
Attachment
Other Similar Questions
User Profile
Tutor...

math project 3-liberty university

Answer for math project 3-liberty university...
User Profile
kmgina

Liberty University MATH 201 Project 3 complete solutions correct answers A+ work

Liberty University MATH 201 Project 3 complete solutions correct answers A+ work Get a good grade! Based on Larson & Farber: sections 5.2–5.3 Go to this website. First, set the date range to be for exactly 1 year ending w...
User Profile
Assig...

CYB 670 Project 3

Your assignment is attached. Thanks for purchasing this assignment!...
User Profile
termp...

Final_Project_3.docx 9-1 Final Project 3: Written Defense Southern New Hampshire Unive

Final_Project_3.docx 9-1 Final Project 3: Written Defense Southern New Hampshire University 44148 We currently live in an age where the way news is consumed is being taken over by digital technologies and mass media. Co...
User Profile
termp...

BUS 206 Project 3 Tort Law.docx BUS 206 BUS 206 Project Three Tort Law New Hampshir

BUS 206 Project 3 Tort Law.docx BUS 206 BUS 206 Project Three “ Tort Law New Hampshire University A tort is an act or omission that gives rise to injury or harm to another and amounts to a civil wrong for which court...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35