Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started