COP3402, Fall 2000, Assignment 3
Extended: Due 11/2 at the start of class
Upload the source of your program and hand in a hard copy.
Create a program that will display a menu like this:
1. (C)hange case
2. (P)rocess a list of numbers
3. (E)xit the program
Please make a menu selection:
The program should read the choice from the user as a string. The
program will continue to read a choice and perform the appropriate actions
until the user selects the exit option. You will need a loop to do this.
-
If the user's choice is '1','c', or 'C', then the program will read a string
from the user and change all of the strings upper case letters to lower case,
and all of its lower case letters to upper case. Display the original string
and the updated string in the output.
-
If the user's choice is '2','p', or 'P', then the program will process a
list of signed numbers. The user may enter up to 80 numbers, but may enter
fewer.
-
First, ask the user for the integer amount of numbers that will be entered.
This number should be between 0 and 80. If it isn't, then ask the user to
re-enter the number. Continue to have the user re-enter the number as long
as the user enters a number out of the range 0..80. If the number is 0, then
print a nice message and redisplay the menu.
-
Read the indicated amount of numbers from the user. Calculate the average
of all the numbers. If there is signed overflow when adding all the numbers,
then print a nice error message and redisplay the menu.
-
Display a nice table of results. The first column should display the numbers,
and the second column should display the difference of the number from the
average. Use the move cursor and get cursor position BIOS routines;
or tabs (09h).
-
If the user's choice is '3','e', or 'E', then print a nice, thankyou message
and exit the menu loop and the end the program.
-
If the user's choice is anything else, then print a nice error message (echoing
the user's choice) and ask for another choice. Continue this until the user
enters a valid choice.
Here are some guidelines for the program
-
Do not alter the original string, nor the original array of numbers.
-
The maximum length of a string to be entered will be 80. The maximum amount
of numbers entered will be 80.
-
Use constants when appropriate.
-
Use lots of procedures. Procedures may only be 24 lines long, including the
main procedure. You will lose one point for every procedure that is longer
than 24 lines.
-
OS calls you will need: read string, write string, move cursor.
-
ASM_IO.INC calls you will need: read_signed, print_signed.
-
Do not use recursion.
-
Only use instructions in the first 6 chapters and DIV and IDIV from chapter
7.
-
Do not jump into a procedure, nor out of a procedure.