Previous Section  < Day Day Up >  Next Section

LAB 44: THE if/else CONSTRUCT AND THE let COMMAND

  1. Write a script called grades that will ask the user for his or her numeric grade on a test.

    1. The script will test that the grade is within the possible grade range, 0 to 100.

    2. The script will tell the user if he or she got an A, B, C, D, or F.

  2. Write a script called calc that will perform the functions of a simple calculator. The script will provide a simple menu:

    
    [a] Add
    
    [s] Subtract
    
    [m] Multiply
    
    [d] Divide
    
    [r] Remainder
    
    

  3. The user will choose one of the letters from the menu.

  4. The user will then be asked to enter two integers between 0 and 100.

  5. If the numbers are out of the range, an error message will be printed and the script will exit.

  6. The program will perform the arithmetic on the two integers.

  7. The answer will be printed in base 10, 8, and 16.

    Previous Section  < Day Day Up >  Next Section