Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Test the program before submitting for good rating Minimal Submitted Files You are required to turn in the following source file: assignment4.s Objectives: -write assembly

Test the program before submitting for good rating

Minimal Submitted Files

You are required to turn in the following source file:

assignment4.s

Objectives:

-write assembly language programs to: -perform decision making using branch instructions. -use syscall operations to display integers and strings on the console window -use syscall operations to read integers from the keyboard.

Assignment Description:

Write a MIPS assembly language program that reads in a sales type (1 or 2) and an amount of some sales. If 0 or a negative integer is entered, then the program should print out "No commission for the sales. ", and exit. Otherwise, if a sale type is 1, and the amount is less than 10000 then the commission number will be 2, otherwise, it will be 4. If a sale type is not 1 (i.e., 2), and the amount is less than 10000 then the commission number will be 3, otherwise, it will be 5. After getting a commission number, it should compute the total commission that is computed by totalCommission = (totalSales/1000)*commissionNum then it should print out the total commission, along with its sales amount. Name your source code file Assignment4.s.

The following shows how it looks like in a C program:

 int salesType; int commissionNum; int totalSales; int totalCommission; printf("What is your sales type (1 or 2)? "); //read an integer from a user input and store it in salesType scanf("%d", &salesType); printf("How much was the sales? "); //read an integer from a user input and store it in totalSales scanf("%d", &totalSales); if (totalSales <= 0) { printf("No commission for the sales. "); } else { if (salesType == 1) { if (totalSales < 10000) commissionNum = 2; else commissionNum = 4; } else { if (totalSales < 10000) commissionNum = 3; else commissionNum = 5; } //compute its total commission totalCommission = (totalSales/1000)*commissionNum; //print out the total commission along with its sales printf("Your total commission is %d for the sales of %d ", totalCommission, totalSales); } //end of else 

Here is a sample output (user input is in bold):

What is your sales type (1 or 2)? 1 How much was the sales? 12000 Your total commission is 48 for the sales of 12000

-----------------------------------------------

Here is another sample output (user input is in bold):

What is your sales type (1 or 2)? 2 How much was the sales? 1400 Your total commission is 3 for the sales of 1400

-----------------------------------------------

Here is another sample output (user input is in bold):

What is your sales type (1 or 2)? 1 How much was the sales? 0 No commission for the sales.

-----------------------------------------------

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

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

There is no finance in financial planning models. Explain.

Answered: 1 week ago

Question

Effective Delivery Effective

Answered: 1 week ago