Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Five students at a local middle school volunteered to sell fresh baked cookies to raise funds to increase the number of computers for the

1. Five students at a local middle school volunteered to sell fresh baked cookies to raise funds to increase the number of computers for the computer lab. Each student reported the number of boxes he/she sold. Cost of each box of cookies was $4.50. Write a program that will output the total number of boxes of cookies sold, the total revenue generated by selling the cookies, and the average number of boxes sold by the students. Prompt the user to enter the following information: the StudentID number and the number of boxes sold.

2. In the program above you know the exact number of student volunteers. Now suppose that the programmer does not know the exact number of volunteers. Once again, assume that the data is in the following form, i.e. the students ID number and the number of boxes sold by the student is provided by the user. Prompt the user to enter this information as in Question 1, but here, you do not know the exact number of volunteers, instead -1 will mark the end of the data entered.

3. Finally, redo question 2, but this time declare a Boolean variable and use it to control the while loop

Q1. Use count controlled while loop or for loop

Q2. Use sentinel value controlled while loop

Q3. Use a boolean flag controlled while loop.

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

What are the three types of IRS examinations?

Answered: 1 week ago

Question

LO2 Explain the major laws governing employee compensation.

Answered: 1 week ago