programming

posted by .

Find Bugs in the pseudocode


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 + 1] = sales[category - 1] + 1
else
output "Invalid category"
endif
output "Enter category ", QUIT, " to quit "
input category
endif
output HEAD1
output HEAD2
category = 0
while category <= SIZE
output category + 1, sales[category]
category = category + 1
endwhile
stop

  • programming -

    Two bugs found.

    There are two "while" bit only one "endwhile", and also one "if" but two "endif". Thus it appears that the second "endif" should be an "endwhile".

    Also, you have "while category = QUIT" when it seems you wish to loop _until_ that condition.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. C programming

    Question: Write a program that reads integers from the keyboard until the user enters the sentinel value -999. The program should then print the minimum integer read, the maximum integer read and the average of all the integers. (Excluding …
  2. C++

    Write a statement that passes the value 4 to the function below and assign it's return value to the variable result. Thank You. int cube(int num) { return num*num*num; }
  3. c++ program

    will this work for a source code that receive and total collection of payroll amounts entered at the terminal until 999 is reached. #include <stdio.h> #include <stdlib.h> main() { int num = 0; printf("Enter number (-999 …
  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 until …
  5. Programming logic

    Finding the bugs. // Each time a salesperson sells a car at the Pardeeville New and Used Auto Dealership, // a record is created containing the salesperson’s name and the amount of the sale. // Sales of new and used cars are kept …
  6. math

    The sum of the digits of a 2 digit num is 15 then the num obtained by reversing the digits exeeds the given no by 9. find the num
  7. Programming

    I need help with debug Debug06-02 // 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 …
  8. programming

    where are the errors the pseudocode debugging exercise // This application reads student typing test data // including number of errors on the test, and the number // of words typed per minute. Grades are assigned based // on the following …
  9. 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 …
  10. Math

    If yuo find four different numbers totaling 54 so that if you ad 2 one of the numbers lf you take 2 from another num if multiply third num by 2 and devide the fourth num by 2 the ans is always be tha same

More Similar Questions