Create a program that calculates your grades based on the


Assignment 1: - Conditional Processing

I have a small program that calculates your grades based on the number of points you accumulate over the entire semester. Let's create that program in this lab assignment.

If you look in the syllabus, this class grades are based on the number of points as follows:

Create a program that will ask the user how many students are in the class. There should be no more than 30 students. Verify that, indeed, the user entered up to 30 students. If he did, go further. If not, display a message that says that only 30 students are allowed in the class and jump back to the question of how any students.

Create a table that will display a header "Student ID", "Points", "Grade" as in the example below. Assign a 5 digit Student ID, starting with 00001. Going through each student id, one by one, use the random procedure to generate a random number of points from 300 to 1000. (We assume that a student will get at least 300 points in a semester). For each student, call a procedure CalculateGrades that will take the number of points and output the corresponding letter.

CalculateGrades Procedure

CalculateGrades uses the EAX register to get the number of points, and outputs the character in AL. Create a procedure header made with comments, that has 3 lines: First line a short description, second line RECEIVES:, third line RETURNS: where you write the registers used.

Note: You have an example of such a position header in your textbook, page 229, SetCursorPosition Example.

RandomRange PROC

Generates an unsigned pseudo-random 32-bit integer in the range of 0 through (n-1).

Call args: EAX = n, the range

Return arg: EAX = random (0 to n-1)

Example: Get a random number from 1 to 100  .data ranNum DWORD ?

.code

mov eax,100 ;get random 0 to 99

callRandomRange ;

inceax ;make range 1 to 100

movranNum,eax ;save random number

To generate a 32-bit random number, use the Random32 Procedure:

Random32 PROC

Generates an unsigned pseudo-random 32-bit integer in the range of 0 through FFFFFFFFh.

Call args: None

Return arg: EAX = random (0 to FFFFFFFFh)

Example:

.data ranNum DWORD ?

.code

call Random32

movranNum,eax ;save

Randomize PROC

Re-seeds the random number generator with the current time in hundredths of seconds.

Call args: None

Return arg: None

Example:

call Randomize ;re-seed generator

Requirements

• Make sure you use the stack this time. You should save all the registers you use before using them inside a procedure.

• Do not use conditional directives.

• Your random numbers should not be below 300, and should be able to reach 1000.

• Do not allow more than 30 students to be listed.

• The leading zeros have to be 4 for single digit numbers and 3 for double digit numbers to be consistent with a 5 digit ID.

• Don't forget to Randomize at the beginning of the program! Otherwise, every time you run the program you will have the same generated numbers.

Assignment 2:

Create a project. Take a look at the code ArryScan.asm shown in your textbook Section 6.3.4. Using ArrayScan.asm as an example, write the following project:

Ask the user to input the number of elements of a character array (less than 50 elements). Ask the user to enter a character that he wants to search in the array. Then ask him to input the characters one by one to fill the array. For this use indirect addressing.

Then your program has to search for the desired character in your array. Again, use indirect addressing. If the character is found, display the following message:

"Found the character x at position y in the array." Careful with the position count. The array starts from zero. ts from zero.

Of course, replace x and y with the corresponding character/number.

If it is not found display:

"The character was not found."

Here is an example:

and

Read the text and make sure you understand the code. Write a comment for each line of code you add to the project.

Verify it builds and runs, archive it and upload it in the Student Submissions area.

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: Create a program that calculates your grades based on the
Reference No:- TGS01128141

Expected delivery within 24 Hours