Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Statement: Chips Snack Bar sells chips ($1), soda ($1.25), hot dogs ($2) and coffee ($0.75). Both Seniors (i.e., age >= 62) and Students are

Problem Statement: Chips Snack Bar sells chips ($1), soda ($1.25), hot dogs ($2) and coffee ($0.75). Both Seniors (i.e., age >= 62) and Students are eligible for a 10% discount. Seniors are not charged for coffee (regardless of the number ordered). All sales are taxed at a rate of 6%. Write a Java program to do the following: 1. Read in an order from the keyboard ( which contains the student status [y], user age, number of chips, number of sodas, number of hot dogs, and number of coffees, in that order), all on separate lines. The program should display prompts to the user as shown in the sample interaction. 2. Display a message repeating the customers order. 3. Calculate and display the subtotal of the order BEFORE discounts and taxes are applied. 4. Calculate the discount and taxes and display them. The tax should be calculated AFTER the discounts have been applied. 5. Calculate and display the final total and thank the user.

Requirements: In addition to fulfilling the interaction described above your program must also 1. Have the main class named CashRegister 2. Make use of constant variables SENIOR_AGE, DISCOUNT_RATE and TAX_RATE. 3. Save intermediate calculations (e.g., subtotal, tax, etc.) in appropriately named variables. 4. Read the input from keyboard. 5. Display the output in a manner consistent with sample interaction described below.

image text in transcribed

This is the output for a 20 year old student who ordered 1 chip, 1 sodas, 1 hot dog and 1 coffees.

Do not worry if you show more or fewer decimal places with the results.

Are you a student [y]? What is your age? 20 How many bags of chips would you like? How many sodas would you like? How many hot dogs would you like? How many cups of coffee would you like? Order summary .I 1 bags of chips 1 sodas 1 hot dogs 1 cups of coffee Subtotal: 5.0 Discount: 0.5 Tax: 0.27 Total: 4.77 Thank you for your order

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

What is OSPR? How does the auditor measure or estimate it?

Answered: 1 week ago

Question

7 How can a culture encourage ethical (or unethical) behaviour?

Answered: 1 week ago