3

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 the user wnats

Question

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 the user wnats
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 the user wnats 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
endwhile
output HEAD1
output HEAD2
while year <= SIZE
output year, collected[year - 1]
year = year + 1
endwhile
stop

DEBUG06-02.txt

// 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

DEBUG06-03.txt

// This program counts how many sales are made in each of 5 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 + 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

Answers

DEBUG06-02.txt

// 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

DEBUG06-03.txt

// This program counts how many sales are made in each of 5 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 + 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

Greetings,

"Healing By Spiritual Doctors" is a book written by T.S which is now available at Apple stores for only $6.99. This book talks about women role throughout the history of creation and the fact that how powerful or known men have tried to buried their influence throughout the history so that their clear voice not be heard.

After 30 years of research in the science of universe,the writer of this book is trying to show the true role of women in the universe and find their roles in healing! In this book you will see how women as Medium, can heal themselves or others by spiritual doctors. This is a gift from god and the pure spirit who are the guidance of our women Medium. This is the book that need to be read by all women so they learn their inner ability and be able to help our society and humanity!
Hope you too hold our hands and be our guidance in this matter.

Sincerely with love,
Taghi Salahshour

To debug, always keep in your mind the value of variables at any time as the program proceeds, and think of exceptional values a user can enter.
Your program must expect users to enter anything because of human errors.
For example, for the recycling program:

// 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 wnats 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 what if user enters 6? -5?
while year <> QUIT
output "Enter number of cans collected "
input cans
collected[year] = collected[year] + cans
endwhile
output HEAD1
output HEAD2
what is the value of "year" at this point, (logic requires it to be 0)
while year <= SIZE
output year, collected[year - 1]
year = year + 1
endwhile
stop


Similar Solved Questions

1 answers
Acceleration
The fastest measured pitched baseball left the pitcher's hand at a speed of 44.0 . If the pitcher was in contact with the ball over a distance of 1.50 and producedconstant acceleration,...
1 answers
   Suppose you're currently producing at letter "C," and your Society is located along Production Possibilities...
   Suppose you're currently producing at letter "C," and your Society is located along Production Possibilities Curve #3. This means (pick one) (a) Your society can produce more of both bread & smart phones.   (b) Your society can produce more bread but only if it...
1 answers
A single card was picked at random from a standard deck. There are 52 cards in...
A single card was picked at random from a standard deck. There are 52 cards in a standard deck. Express your answer as reduced fractions. The probability that the card is a spade or a 2. The probability that the card is a red Q....
1 answers
Pastina Company sells various types of pasta to grocery chains as private label brands. The company's...
Pastina Company sells various types of pasta to grocery chains as private label brands. The company's reporting year-end is December 31. The unadjusted trial balance as of December 31, 2021, appears below. Credits Debits 35,500 43,000 3,000 63,000 23,000 2,500 9,000 92,000 34,500 34,000 53,000...
1 answers
Describes the importance of leadership in healthcare with an overarching idea
describes the importance of leadership in healthcare with an overarching idea...
2 answers
Question 3 (30 marks) A- The following transactions occurred between the home office and the Mason...
Question 3 (30 marks) A- The following transactions occurred between the home office and the Mason Branch of Smaldino Company: Cash of $1,000 was forwarded by the home office to Mason Branch. Merchandise with a home office cost of $60,000 was shipped by the home office to Mason Branch. Equipment ...
1 answers
Inding examples of the reed along the banik of a nver in Southem Caltormia and measuring...
inding examples of the reed along the banik of a nver in Southem Caltormia and measuring the distan between these quanthes A portion of the data which was collected s provided below mere is a linear resationship 16 4.41 114 36 125 299 146 2 82 18 2 223 263...
1 answers
Lambda Computer Products competed for and won a contract to produce two prototype units of a...
Lambda Computer Products competed for and won a contract to produce two prototype units of a new type of computer that is based on laser optics rather than on electronic binary bits. The first unit produced by Lambda took 5,000 hours to produce and required $250,000 worth of material, equipment usag...
1 answers
If a patient is prescribed tablets gr ss once daily and the available tablets are gr...
If a patient is prescribed tablets gr ss once daily and the available tablets are gr i, thern tablets would be given in a 14-day period. (Enter numerical answer only, do not enter units)...
1 answers
Suppose that $25,000 from a retirement account is invested in a large cap stock fund. After...
Suppose that $25,000 from a retirement account is invested in a large cap stock fund. After 30 yr, the value is $157,317.42. Part: 0/2 Part 1 of 2 (a) Use the model A=Pe to determine the average rate of return under continuous compounding. Round to the nearest tenth of a percent. Avoid rounding in i...
1 answers
How do you simplify #-\frac { 9x - 9y } { 8x } + \frac { 4x - 11y } { 8x }#?
How do you simplify #-\frac { 9x - 9y } { 8x } + \frac { 4x - 11y } { 8x }#?...
1 answers
How do cytokines affect the humoral immune response?
How do cytokines affect the humoral immune response?...
1 answers
Concentrations of some glycolysis intermediates in the red blood cell (mM): Glucose Glucose-6-P Fructose-6-P Fructose-1,6-BP 1,3-bisphosphoglycerate...
Concentrations of some glycolysis intermediates in the red blood cell (mM): Glucose Glucose-6-P Fructose-6-P Fructose-1,6-BP 1,3-bisphosphoglycerate 0.001 3-phosphoglycerate 5.0 0.083 0.014 0.031 2- phosphoglycerate Phosphoenolpyruvate Pyruvate ATP ADP Pi 0.030 0.023 0.051 1.85 0.14 1.0 0.12 3. Isot...
1 answers
If #P(x)=3x^3-2x^2-x+8#, what is #P(-3i)#?
If #P(x)=3x^3-2x^2-x+8#, what is #P(-3i)#?...
2 answers
How do you divide #(4x^2+x+1)div(x-2)# using synthetic division?
How do you divide #(4x^2+x+1)div(x-2)# using synthetic division?...
1 answers
ISO 9000 is a set of international performance standards on quality management developed and published in...
ISO 9000 is a set of international performance standards on quality management developed and published in 1987 by the International Organization for Safety. a. TRUE. b. FALSE. The central issue of Statistical Quality Control (SPC) is to identify, while products are being manufactured, the ones that ...
1 answers
A 0.840- kg glider on a level air track is joined by strings to two hanging...
A 0.840- kg glider on a level air track is joined by strings to two hanging masses. As seen in the figure, the mass on the left is 4.85 kg and the one on the right is 3.62 kg The strings have negligible mass and pass over light, frictionless pulleys. Find the acceleration of the masses when the air ...
1 answers
Today and in the future, do you think it is important for a firm to think...
Today and in the future, do you think it is important for a firm to think globally but act locally? Why? Give some examples of companies and their actions in this regard. class is -principles of marketing class...
1 answers
12. Calculate the LOD score for pedigree below, assuming autosomal dominant inheritance, using the maximum likelihood...
12. Calculate the LOD score for pedigree below, assuming autosomal dominant inheritance, using the maximum likelihood estimation of the recombination fraction. Make a quantitative statement about the evidence for or against linkage (15 points). 4/3 411 411 4/1 4/1 4/1 4/1 4/1 4/1...

-- 0.052673--