Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Modify the coffee shop program Add code that allows multiple customers This will require a loop Also, each customer can buy regular coffee,

In Javaimage text in transcribed

image text in transcribed

Modify the coffee shop program Add code that allows multiple customers This will require a loop Also, each customer can buy regular coffee, latte, or espresso Again, customers can buy multiple cups However, all cups must be the same type You should have different prices for the different types of drinks Your submission should consist of a test class as well as the coffee shop class Create methods as appropriate. Use good design principles: Ask the customer the various questions Avoid excessive questions and options Make sure you follow basic coding principles Comment each method and other parts of the code, as you think it's appropriate class CoffeeShop { double total; void calcBill (int numCups) { final double cupCost = 2.35; double subtotal, salesTax; // Calculate the subtotal subtotal = cupCost * numCups; // Calculate the sales tax salesTax = 0.09 * subtotal; // Calculate the full price total = subtotal + sales Tax; double getBill ( { return total; } }

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_2

Step: 3

blur-text-image_3

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

1. What might have led to the misinformation?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago