Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

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

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago