programming

using pseudocode debug the following 3 programs

// A high school is holding a recycling competition
// This program allows a user to enter a student's
// year in school (1 through 4)
// and number of cans collected
// Data is entered continuously until the user wants to quit
// After headings, output is four lines
// one for each school year class
start
Declarations
num year
num cans
num SIZE = 4
num QUIT = 9
num collected[SIZE] = 0, 0, 0, 0
string HEAD1 = "Can Recycling Report"
string HEAD2 = "Year Cans Collected"
output "Enter year of student or ", QUIT, " to quit "
input year
while year <> QUIT
output "Enter number of cans collected "
input cans
collected[year] = collected[year] + cans
output "Enter year of student or ", QUIT, " to quit "
input year
endwhile
output HEAD1
output HEAD2
year = 1
while year < SIZE
output year, collected[year - 1]
endwhile
stop

// Program lets user input scores on four tests
// Average is computed and letter grade is determined
// Letter grades are based on 90 for an A, 80 for a B, and so on
start
string name
num score
num NUM_TESTS = 4
num NUM_RANGES = 5
num RANGES[NUM_RANGES] = 90, 80, 70, 60, <=50
num QUIT = ZZZZZ
string GRADES[NUM_RANGES] = "A", "B", "C", "D", "F"
num total
num average
num sub
output "Enter student name or ", QUIT, " to quit "
input name
while name <> QUIT
total = 0
while sub < NUM_TESTS
output "Enter score "
input score
total = total + score
endwhile
average = total / NUM
sub = 0
while average < RANGES[SIZE]
sub = sub + 1
endwhile
letterGrade = GRADES[sub]
output name, letterGrade
output "Enter student name or ", QUIT, " to quit "
input name
endwhile
stop

// This program counts how many sales are made in each of five categories of products
start
Declarations
num category
num SIZE = 5
num QUIT = 9
num sales[SIZE] = 0, 0, 0, 0, 0
string HEAD1 = "Sales"
string HEAD2 = "Category Number of Sales"
output "Enter category ", QUIT, " to quit "
input category
while category = QUIT
if category >= 1 AND category <= SIZE then
sales[category] = sales[category] + 1
else
output "Invalid category"
endif
output "Enter category ", QUIT, " to quit "
input category
endwhile
output HEAD1
output HEAD2
category = 0
while category <= SIZE
output category + 1, sales[SIZE]
category = category + 1
endwhile
stop

  1. 👍 0
  2. 👎 0
  3. 👁 137
asked by dan

Respond to this Question

First Name

Your Response

Similar Questions

  1. Debug=true

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: 1. Add a "Debug=true" directive at the top of the

    asked by Amy~ on January 13, 2011
  2. MATH

    Elsie is starting a recycling club at her school and hopes to use the money earned from recycling cans to buy recycling bins for the school. Elsie first needs to figure out how much the cans that can be collected at her school

    asked by abby on March 2, 2010
  3. math

    Question: For the competition, each band member needs $12 for food. To get to the competition, the school rents 3 buses that cost $580 each. Write and evaluate an expression for the three costs. - Answer: (75/12) + (3/580) = -

    asked by Anon on October 2, 2015
  4. programming logic

    Find Bugs in the pseudocode // A high school is holding a recycling competition // This program allows a user to enter a student's // year in school (1 through 4) // and number of cans collected // Data is entered continuously

    asked by tina on April 15, 2012
  5. Introduction to Graphic Design

    Hello! Thanks for checking my question out! ____ 10. Which of the following are reasons why it is important to properly recycle electronic equipment? Select all that apply. (3 points) a) Recycling electronic equipment conserves

    asked by Da Fash on September 26, 2017
  6. Logic and Design

    I need help with pseudocode, and any help regarding forming these programs in Visual Logic would be helpful as well. Question 1: You have been asked to design the logic that will display each of the following lines to a screen.

    asked by Brandon on August 5, 2008
  7. English

    1. I am a freshman in high school. 2. I am a freshman of high school. (Which preposition should we use? Are both OK?) 3. There'll be a parade on the anniversary day. (How do you pronounce "There'll"?) 4. We'll choose between upper

    asked by rfvv on March 8, 2011
  8. English

    1. I like animated programs. 2. I like animation programs. (Which one is correct? Are both OK?) 3. I like Briticom programs. 4. I like Briticoms. (Are both OK?) 5.I like cooking programs. 6. I like cookings. (Is #6 correct?) 7. I

    asked by John on March 25, 2009
  9. math

    The recycling center pays 25 cents per kg for aluminum cans. If her school recycles 2070 cans each day, how much money will Elsie earn each day by recycling?

    asked by abby on March 2, 2010
  10. Intro to Business

    The U.S. Supreme Court ruled that cities could have school voucher programs that give money directly to parents, who could then choose between competing schools, public or private. The idea was to create competition among schools.

    asked by Lisa on January 6, 2011

More Similar Questions