Programming

posted by .

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 NUM_TESTS = 4
num NUM_RANGES = 5
num RANGES[NUM_RANGES] = 90, 80, 70, 60, 0
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
sub = 0
while sub < NUM_TESTS
output "Enter score "
input score
total = total + score
endwhile
average = total / NUM_TESTS
sub = 0
while average < RANGES[NUM_TESTS]
sub = sub + 1
endwhile
letterGrade = GRADES[NUM_TESTS]
output name, letterGrade
output "Enter student name or ", QUIT, " to quit "
input name
endwhile
stop

  • Programming -

    If you need debug help, please
    1. specify the compiler/language
    2. supply error messages you got when the programme was executed or compiled.
    3. indicate if it is a compilation, execution or logical error.


    This one looks fishy:
    output "Enter student name or ", QUIT, " to quit "

    probably should read
    output "Enter student name or QUIT to quit "

    here:
    while sub < NUM_TESTS
    output "Enter score "
    input score
    total = total + score
    endwhile

    will run forever unless you increment sub.

    while sub < NUM_TESTS
    output "Enter score "
    input score
    total = total + score
    sub=sub+1
    endwhile

    letterGrade = GRADES[NUM_TESTS]
    means you'll always get an F.
    I suggest
    letterGrade = GRADES[sub]

    Good luck!

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Computer Programing & Logic Design

    Submit pseudocode and a flowchart for the following programming exercise: Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average …
  2. programming

    2-5 Grade Determination is says " Write a program that will input three test scores. the program should determine and display their average. the program should then display the appropriate letter grade based on there average. the letter …
  3. 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 …
  4. c++

    Write a program that asks the user to input a grade that he or she received on an exam. The grade is an integer from 0 to 100 inclusive. The program should convert the numeric grade into the equivalent letter grade. Do the conversion …
  5. 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 …
  6. programming

    Professor Merlin has asked you to help him. He has 5 students who have taken four tests. He wants a program where he can enter the students name and their four test scores. After entering all 5 students then he wants a grade report …
  7. ICT (Programming)

    Design program logic that receives the letter grades for 4 subjects and then based on the grades, calculate the total grade point. The program should use IF statements to determine the grade point corresponding to the letter grade …
  8. C++programming

    Write an interactive C program that will accept each student’s name an exam grades as input, determine an average grade for each student, and then display the student’s name, the individual exam grades and the calculated average. …
  9. java programming

    Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: • calcAverage—This …
  10. Probability

    After an exam, a teacher starts checking student attempts. Based on the marks he gives, he also awards a letter grade from any of the 5 letter grades; A, B, C, D, and F. How many papers on average should he expect to check to see all …

More Similar Questions