Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE/EEE230 Assignment4 Due Date Thursday, January 24th, 5pm Important: This is an individual assignment. Please do not collaborate. It must be submitted on-line (Blackboard). No

CSE/EEE230 Assignment4

Due Date

Thursday, January 24th, 5pm

Important: This is an individual assignment. Please do not collaborate.

It must be submitted on-line (Blackboard).

No late assignment will be accepted

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.

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

What to turn in:

-Upload your assignment4.s file through the assignment submission link in the Blackboard by the assignment deadline. You must have your name, email address, program description, and other information in the header block as it was described in the assignment 1, and your programs should be well commented.

Grading Criteria:

____/ 5 Documentation (header with your name, your information, and program description and comments within your code)

____/ 1 Indentation and spacing (easy to read)

____/ 6 Required functions and functionalities implemented

____/ 8 Produces correct results?

Total points: 20

Please help, thanks!

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

Students also viewed these Databases questions

Question

recognise typical interviewer errors and explain how to avoid them

Answered: 1 week ago

Question

identify and evaluate a range of recruitment and selection methods

Answered: 1 week ago

Question

understand the role of competencies and a competency framework

Answered: 1 week ago