Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Collect a series of int or double values from the user until the user enters a sentinel value when done. Display back to the user

Collect a series of int or double values from the user until the user enters a sentinel value when done. Display back to the user what they entered. Calculate and display the average value.
you can write 1 file that has a main method
You must use an Array [ not ArrayList ] of int or double
Your Array must be able to hold up to 10 items
You must use a sentinel value so the user can indicate they have finished entering data
Do not allow the user to overfill the array
If a user enters no data, note that
On the output back to the user display a header and show the index
After the displayed array show the average
Example:
Enter the number of fruits sold(-1 when done):81
Enter the number of fruits sold(-1 when done):60
Enter the number of fruits sold(-1 when done):75
Enter the number of fruits sold(-1 when done):58
Enter the number of fruits sold(-1 when done):32
Enter the number of fruits sold(-1 when done):5
Enter the number of fruits sold(-1 when done):94
Enter the number of fruits sold(-1 when done):-1
Fruit
# Sold
===== ======
0 81
1 60
2 75
3 58
4 32
5 5
6 94
Average Fruits Sold: 57.9
Press any key to continue . . .

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

Decisions Based On Data Analytics For Business Excellence

Authors: Bastian Weber

1st Edition

9358681683, 978-9358681680

More Books

Students also viewed these Databases questions