Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me code the following in JAVA! Please do so in as simple way possible, so I can understand! Full points will be rewarded,

Please help me code the following in JAVA!

Please do so in as simple way possible, so I can understand!

Full points will be rewarded, thanks in advance!

~Summary

In this assignment, you will ask for the sales for three stores, named "Store 1," "Store 2," and "Store 3." You will then ask for the threshold in sales you'd like to find out which stores have exceeded. Based on those values, the program will print out a message saying which stores exceeded the threshold in sales and the average sales of the stores that exceeded the threshold. If no stores exceeded the threshold, a message is printed out saying so but no average is printed out.

Note that for this assignment, you may not use loops, even if you already know how to use loops. Also, no arrays. This will make the program trickier to write but we are practicing to think through the branching logic.

Thinking About How to Write the Program:

We can roughly break-up the program into three sections:

-Reading in the data values from the keyboard

-Doing the logical tests

-Writing out the report

Here are some questions you'll want to think about to help you with the center part:

What are all the possible cases? There are more possible cases than you might think about at first.

How will you deal with the fact the "average" sales for one store is just that store's sales but when two or three stores exceed the threshold, the averages will be calculated using different divisors?

How will you tell the reporting portion not to write an average sales amount if no one exceeds the threshold, while the reporting portion does do so for the other cases?

Note that for this program you don't have to test to see whether the input values are valid. For instance, you can assume the input will be a zero or positive double. Don't worry about writing code to detect someone entering in characters, negative numbers, etc.

Sample Output:

Here is output from three runs of the program. Your program should be able to duplicate this:

*Remember, no loops or arrays!

image text in transcribed

Enter the sales for Store 1: 21.99 Enter the sales for Store 2: 10.99 Enter the sales for Store 3: 100.99 Enter the sales threshold: 30.00 Store 3 did great! The average sales for exceeding stores: 100.99 Enter the sales for Store 1: 21.99 Enter the sales for Store 2: 10.99 Enter the sales for Store 3: 100.99 Enter the sales threshold: 20.00 Store 1 and 3 did great! The average sales for exceeding stores: 61.49 Enter the sales for Store 1: 21.99 Enter the sales for Store 2: 10.99 Enter the sales for Store 3: 100.99 Enter the sales threshold: 500.00 No store met the threshold

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions