Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the assignment, its extra long so i could make it as readable as possible. I need to complete the pseudocode as well as

This is the assignment, its extra long so i could make it as readable as possible. I need to complete the pseudocode as well as the flowgorithm. I am lost and need to know how to get this done. Thank you in advance.

Condition Controlled and Counter Controlled Loops 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 a seven day period. The program should allow the user to enter the number of bottles returned for each of the seven days. The program will calculate the total number of bottles returned for the 7 day period and calculate 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. Allow the user to enter multiple transactions.

Step 1: In the pseudocode below (pg 5), declare the following variables under the documentation for Step 1.

// Define a variable for bottles that is initialized to 0 //This variable will store the number of bottles entered

//Define a variable for totalBottles that is initialized to 0 //This variable will store the accumulated bottle values

//Define a variable for count that is initialized to 1 //This variable will be used as a counter for the 7 days

//Define a variable for MAXDAYS (constant) that is initialized to 7 //This variable will be used as the sentinel value

//Define a variable for totalPayout that is initialized to 0 //This variable will store the calculated value of totalBottles times .10

//Define a variable for continue that is initialized to y //This variable will be used to run the program again

Step 2: Consider the following to steps and complete the pseudocode (pg 5) for the body of the main module.

_ Continue to process while continue is equal to y

_ Initialize totalBottles to 0 For number of bottles collected over 7 days

_ Prompt and store the number of bottles collected

_ Accumulate totalBottles

_ Calculate the total payout based on the total number of bottles collected

_ Display The total number of bottles collected: & totalBottles

_ Display The payout for this transaction $ & totalPayout

_ Prompt the user Do you want to enter another transaction?

_ Get the user entry continue

_ Display Process Complete

Step 3: In the pseudocode below, write a condition controlled while loop around your counter controlled loop for accumulating the total. using the continue variable under the documentation for Step 3. You will also need to reset the bottle accumulator so you can begin again with the next transaction. Complete Steps 1-3 below:

Module main ()

//Step 1: Declare variables //Step 1: Initialize variables

//Step 2: Condition controlled Loop to run program again

While

// Initialize totalBottles variable to 0

//Step 2: Counter controlled Loop- accumulate bottles

// collected over 7 days For

//Step 2: Prompt for and get the number of bottles collected for the day

//Step 2: Accumulate totalBottles

End For

//Step 2: Calculate the payout

Display Total number of bottles collected: & ____

Display Payout for this transaction $ & ________

Display Do you want to complete another transaction?

Display (Enter y for yes).

//Step 2: Store the user entry Input _________________________________

End While

Display Process Complete

End Module

Lab 5 - Flowchart Now, convert your pseudocode above to a flowgorithm flowchart. Test your program against the following values. If there is an error, go back through the steps to locate the problem.

Input Values Expected Ouput

Seven days of bottles: The total number of bottles collected were: 4582

346 The total amount paid out is $458.2000

238

638

890

1035

899

536

Total number of bottles collected: 4582

Payout for this transaction $458.2000

Do you want to complete another transaction?

y

Input Values Expected Output

Seven days of bottles: The total number of bottles collected were: 12245

123 The total amount paid out is $1224.50

526

52

480

9951

324

789

The total number of bottles collected: 12245

Payout for this transaction $1224.50

Do you want to complete another transaction?

n

Process Complete

Complete the pseudocode and create the flowgorithm.

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions