Lab 3: Modify JavaScript Loop Example #3 (Chapter 7)

The pseudo code in red represents the changes.

Due: 10/11/2012

Initialize passes to zero
Initialize failures to zero
Initialize badInput to zero
Initialize student to one

 

While student counter is less than or equal to ten
    Input the next exam result

    If the next exam result is one then
        Add one to passes
    Else
If the next exam result is two then
       
Add one to failures
    Else
        Display Error Message "You must enter a one for pass or two fail"
        If this is the third failed attempt for this input cycle then
            Display Error Message "Too many failed attempts, application terminated"
            Stop all processing
        Else
            Retry above Input the next exam result

    Add one to student counter

 

Print the number of passes
Print the number of failures
 

If more than eight students passed
    Print .Raise tuition.