Write a Python code This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator.  The program is as follows:    Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days.   The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents).   The output of the program should include the total number of bottles returned and the total paid out.    The program will ask the user if they have more data to enter and will end the program if they do not.   Step 1:  In the pseudocode below, declare the following variables under the documentation for Step 1.  A variable called totalBottles that is initialized to 0 This variable will store the accumulated bottle values A variable called counter and that is initialized to 1 This variable will control the loop A variable called todayBottles that is initialized to 0 This variable will store the number of bottles returned on a day A variable called totalPayout that is initialized to 0 This variable will store the calculated value of totalBottles times .10 A variable called keepGoing that is initialized to "y" This variable will be used to run the program again   Step 2:  In the pseudocode below, make calls to the following functions under the documentation for Step 2. A function call to getBottles that returns the total number of bottles for the week. A function called calcPayout that passes totalPayout and It returns the total payout for the week. A module called printInfo that passes totalBottles and     Step 3:  In the pseudocode below, write a condition controlled while loop around your function calls using the keepGoing variable under the documentation for Step 3.   Complete Steps 1-3 below:   Module main ()    // Step 1: Declare variables below    ___________________________________________________    ___________________________________________________    ___________________________________________________    ___________________________________________________    ___________________________________________________          // Step 3: Loop to run program again    While _________________________________       // Step 2: Call functions       totalBottles = _________________________________       totalPayout  = _________________________________       ________________________________________________                   Display "Do you want to enter another week’s worth of data?"       Display "(Enter y or n)"       Input _________________________________    End While      End Module       Step 4:  In the pseudocode below, write the missing lines, including: The 3 missing variable declarations and initializing them to 0 The missing condition (Hint: should run seven iterations) The missing input variable The missing accumulator The increment statement for the counter The missing return statement   // getBottles function Function getBottles()     NBR_OF_DAYS = 7     // Declare and initialize totalBottles, todayBottles, counter to 0 ___________________________________                 ___________________________________                 ___________________________________       While b._______________________________              Display "Enter number of bottles returned for day #",                       counter, ":"              Input c.______________________________ ___________________________________ ___________________________________         End While       Return f._______________________________ End Function   Step 5:  In the pseudocode below, write the missing lines, including: The missing parameter list The missing calculation The missing return statement   // calcPayout function Function Real calcPayout(a.______________________)      PAYOUT_PER_BOTTLE = .10       totalPayout = 0 // resets to 0 for multiple runs ______________________________       Return c._________________________ End Function   Step 6:  In the pseudocode below, write the missing lines, including: The missing parameter list The missing display statement The missing display statement   // printInfo module Module printInfo(a.______________________________________) _______________________________________________ _______________________________________________ End Module

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 13E
icon
Related questions
Question

Write a Python code

This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator.  The program is as follows: 

 

Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days.

 

The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents).

 

The output of the program should include the total number of bottles returned and the total paid out. 

 

The program will ask the user if they have more data to enter and will end the program if they do not.

 

Step 1:  In the pseudocode below, declare the following variables under the documentation for Step 1. 

  • A variable called totalBottles that is initialized to 0
    • This variable will store the accumulated bottle values
  • A variable called counter and that is initialized to 1
    • This variable will control the loop
  • A variable called todayBottles that is initialized to 0
    • This variable will store the number of bottles returned on a day
  • A variable called totalPayout that is initialized to 0
    • This variable will store the calculated value of totalBottles times .10
  • A variable called keepGoing that is initialized to "y"
    • This variable will be used to run the program again

 

Step 2:  In the pseudocode below, make calls to the following functions under the documentation for Step 2.

  • A function call to getBottles that returns the total number of bottles for the week.
  • A function called calcPayout that passes totalPayout and It returns the total payout for the week.
  • A module called printInfo that passes totalBottles and

 

 

Step 3:  In the pseudocode below, write a condition controlled while loop around your function calls using the keepGoing variable under the documentation for Step 3.

 

Complete Steps 1-3 below:

 

Module main ()

   // Step 1: Declare variables below

   ___________________________________________________

   ___________________________________________________

   ___________________________________________________

   ___________________________________________________

   ___________________________________________________

     

   // Step 3: Loop to run program again

   While _________________________________

      // Step 2: Call functions

      totalBottles = _________________________________

      totalPayout  = _________________________________

      ________________________________________________

           

      Display "Do you want to enter another week’s worth of data?"

      Display "(Enter y or n)"

      Input _________________________________

   End While     

End Module

 

 

 

Step 4:  In the pseudocode below, write the missing lines, including:

  1. The 3 missing variable declarations and initializing them to 0
  2. The missing condition (Hint: should run seven iterations)
  3. The missing input variable
  4. The missing accumulator
  5. The increment statement for the counter
  6. The missing return statement

 

// getBottles function

Function getBottles()

    NBR_OF_DAYS = 7

    // Declare and initialize totalBottles, todayBottles, counter to 0

  1. ___________________________________

                ___________________________________

                ___________________________________

 

    While b._______________________________

             Display "Enter number of bottles returned for day #",

                      counter, ":"

             Input c.______________________________

  1. ___________________________________
  2. ___________________________________

 

      End While

      Return f._______________________________

End Function

 

Step 5:  In the pseudocode below, write the missing lines, including:

  1. The missing parameter list
  2. The missing calculation
  3. The missing return statement

 

// calcPayout function

Function Real calcPayout(a.______________________)

     PAYOUT_PER_BOTTLE = .10

      totalPayout = 0 // resets to 0 for multiple runs

  1. ______________________________

      Return c._________________________

End Function

 

Step 6:  In the pseudocode below, write the missing lines, including:

  1. The missing parameter list
  2. The missing display statement
  3. The missing display statement

 

// printInfo module

Module printInfo(a.______________________________________)

  1. _______________________________________________
  2. _______________________________________________

End Module

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage