Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integer and Floating Point Arithmetic Using the Stack Objectives: This exercise aims to give you practice with the floating-point unit and the stack. Description: Write

image text in transcribed
image text in transcribed
Integer and Floating Point Arithmetic Using the Stack Objectives: This exercise aims to give you practice with the floating-point unit and the stack. Description: Write a MASM program to perform the following tasks: 1. Display the program title and your name. 2. Then get the user's name and greet the user. 3. Prompt the user to choose between integer or floating-point arithmetic. 4. Using a counted loop, prompt the user to give 5 integer or floating-point numbers based on the choice they did. Push the numbers into the integer or floating-point stack based on the choice they did. 5. Calculate and display the sum and the average of the numbers entered. 6. Ask the user if they want to perform another calculation or exit. 7. When the user chooses to exit the program, display a goodbye message that includes the user's name and terminate the program. Requirements: 1. The main procedure must be divided into the following sections: a. Introduction b. User instructions C. Get the data d. Calculate sum e. Calculate average f. Display numbers g. Choose between continue or exit h. Say goodbye 2. The loop that gets the numbers from the user should be implemented as counted loop. 3. The program should not use any variables to store the numbers. Everything should be done using the stack and registers should be used only for the operations. 4. All the requirements regarding documentation, readability, user-friendliness apply. Example execution (user input is in italics): Integer and Floating-Point Arithmetic Programmed by Leonardo Pisano What's your name? Paul Hello, Paul, do you want to perform integer or floating-point arithmetic? Please type "O" for integer or "1" for floating point arithmetic. You choose to perform floating point arithmetic. Please enter 5 numbers The sum of the numbers you enter is: 50.5 The average of the numbers is: 10.1 Do you want to perform another calculation? Please enter "O" for "no" or "1" for "yes". Goodbye, Paul Questions: 1) What is the address EIP has after the "loop" instruction? Do you expect EIP to have that address? Why? 2) What is the address EIP has after the user chooses to perform another calculation? Do you expect EIP to have that address? Why? 3) How does the address ESP change as the user enters the numbers for the integer arithmetic? How does it change when the operations are performed? Why? 4) How was the experience working with the stack? Did you struggle at all? Integer and Floating Point Arithmetic Using the Stack Objectives: This exercise aims to give you practice with the floating-point unit and the stack. Description: Write a MASM program to perform the following tasks: 1. Display the program title and your name. 2. Then get the user's name and greet the user. 3. Prompt the user to choose between integer or floating-point arithmetic. 4. Using a counted loop, prompt the user to give 5 integer or floating-point numbers based on the choice they did. Push the numbers into the integer or floating-point stack based on the choice they did. 5. Calculate and display the sum and the average of the numbers entered. 6. Ask the user if they want to perform another calculation or exit. 7. When the user chooses to exit the program, display a goodbye message that includes the user's name and terminate the program. Requirements: 1. The main procedure must be divided into the following sections: a. Introduction b. User instructions C. Get the data d. Calculate sum e. Calculate average f. Display numbers g. Choose between continue or exit h. Say goodbye 2. The loop that gets the numbers from the user should be implemented as counted loop. 3. The program should not use any variables to store the numbers. Everything should be done using the stack and registers should be used only for the operations. 4. All the requirements regarding documentation, readability, user-friendliness apply. Example execution (user input is in italics): Integer and Floating-Point Arithmetic Programmed by Leonardo Pisano What's your name? Paul Hello, Paul, do you want to perform integer or floating-point arithmetic? Please type "O" for integer or "1" for floating point arithmetic. You choose to perform floating point arithmetic. Please enter 5 numbers The sum of the numbers you enter is: 50.5 The average of the numbers is: 10.1 Do you want to perform another calculation? Please enter "O" for "no" or "1" for "yes". Goodbye, Paul Questions: 1) What is the address EIP has after the "loop" instruction? Do you expect EIP to have that address? Why? 2) What is the address EIP has after the user chooses to perform another calculation? Do you expect EIP to have that address? Why? 3) How does the address ESP change as the user enters the numbers for the integer arithmetic? How does it change when the operations are performed? Why? 4) How was the experience working with the stack? Did you struggle at all

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago