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.\n",
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)?\n");
//read an integer from a user input and store it in salesType
scanf("%d", &salesType);
printf("How much was the sales?\n");
//read an integer from a user input and store it in totalSales
scanf("%d", &totalSales);
if (totalSales <= 0)
{
printf("No commission for the sales.\n");
}
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 \n", 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
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
Program Screenshot:





Sample output:

Code to copy:
#data section.
.data
#declare the variables
salesType: .word 0
commissionNum : .word 0
totalSales: .word 0
totalCommission: .word 0
#declare the string variables
prompt1: .asciiz "What is your sales type
(1 or 2)? "
prompt2: .asciiz "How much was the sales?
"
prompt3: .asciiz "No commission for the
sales. "
prompt4: .asciiz "Your total commission is
"
prompt5: .asciiz " for the sales of
"
prompt6: .asciiz "commission
"
#Main program
.text
.globl main
main:
#assign the variables to the registers
lw $t0,salesType
lw $t1,totalSales
lw $s0,commissionNum
lw $s3,totalCommission
#assign $t2 with value 10000
li $t2, 10000
#prompt the user for sales type
la $a0,prompt1
li $v0,4
syscall
#read the sales type
li $v0,5
syscall
#move sales type value in $t0
move $t0,$v0
#prompt the user for number of sales.
la $a0,prompt2
li $v0,4
syscall
#read the number of sales.
li $v0,5
syscall
#move number of sales value in $t1
move $t1,$v0
#check if totalSales <= 0
#if yes, then go to exit.
ble $t1, 0, exit
#otherwise, check if salesType == 1
#if yes go to salesType1
beq $t0, 1, salesType1
#else go to salesType2
j salesType2
salesType1:
#check if totalSales < 10000
#if yes, then go to makeTwo.
blt $t1, $t2, makeTwo
#else make commissionNum = 4
li $s0, 4
#then go to calculate
j calculate
makeTwo:
#make commissionNum = 2
li $s0, 2
#then go to calculate
j calculate
salesType2:
#check if totalSales < 10000
#if yes, then go to makeThree.
blt $t1, $t2, makeThree
#else make commissionNum = 5
li $s0, 5
#then go to calculate
j calculate
makeThree:
#make commissionNum = 2
li $s0, 3
#computes its total commission
calculate:
#find totalSales/1000
div $s3,$t1,1000
#find (totalSales/1000)*commissionNum
#store the result in $s3
mul $s3,$s3,$s0
#print out the total commission along with its
sales
la $a0,prompt4
li $v0,4
syscall
li $v0, 1
move $a0, $s3
syscall
la $a0,prompt5
li $v0,4
syscall
li $v0, 1
move $a0, $t1
syscall
#end program
li $v0, 10
syscall
#prints No commission for the sales.
#and ends the program.
exit:
la $a0,prompt3
li $v0,4
syscall
#end program
li $v0, 10
syscall
Kindly revert for any queries
Thanks.
CSE/EEE230 Assignment4 Due Date Thursday, January 24th, 5pm Important: This is an individual assignment. Please do...
CSE/EEE230 Assignment11 Due Date Thursday, April 25th, 5pm Note: the lowest scored assignment will be dropped. 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: assignment11.s Objectives: -write assembly language programs to: -perform arithmetic on floating point numbers -use syscall operations to display floating point numbers and strings on the console window...
CSE/EEE230 Assignment11 Due Date Thursday, April 25th, 5pm Note: the lowest scored assignment will be dropped. 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: assignment11.s Objectives: -write assembly language programs to: -perform arithmetic on floating point numbers -use syscall operations to display floating point numbers and strings on the console window -use syscall...
PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to: -define a recursive procedure/function and call it. -use syscall operations to display integers and strings on the console window -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9 if n <= 5 =...
Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS PLEASE EMAIL ME! This programming assignment will just be a small extension to programming assignment 1. In the first assignment each of the functions could only take a predefined number of inputs. This time the objective is to be able to complete these functions with any amount of inputs. The user will pass arguments through the command line (this means you will have to...
Within this C program change the input to a file instead of individual input from the user. You must take the input file name on the command line. Be sure to have simple error checking to be sure the file exists and was successfully opened. The input file will have the following format: First line: Number of students Second Line: Number of grades Third Line: Student Names, space delimited Fourth+ Line(s): Grades for all students for one assignment, space delimited....
C++ HELP I need help with this program. I have done and compiled this program in a single file called bill.cpp. It works fine. I am using printf and scanf. Instead of printf and scanf use cin and cout to make the program run. after this please split this program in three files 1. bill.h = contains the class program with methods and variables eg of class file class bill { } 2. bill.cpp = contains the functions from class...
C++ HELP I need help with this program. I have done and compiled this program in a single file called bill.cpp. It works fine. But I need to split this program in three files 1. bill.h = contains the class program with methods and variables 2. bill.cpp = contains the functions from class file 3. main.cpp = contains the main program. Please split this program into three files and make the program run. I have posted the code here. #include<iostream>...
Please help me with this program. Using C++ (printf & scanf) statements. Thank you. ASSIGNMENT: Write a program to ask the user for a number that includes a decimal point. Then display the integer part of the number (the part of the number to the left of the decimal point) and the decimal part of the number (the part of the number to the right of the decimal point, including the decimal point Follow the 3 steps in the Information...
C Programming I have this cost estimation program, but I want to add to it more functions to be more accurate and more useful. I want to add to the program an array and a loop that can help me with the materials that can be use to the building, as ceramic, wood and concrete and extra functions. ########## #include <stdio.h> int main(void) { float wid,len,yrs; int metersq = 2000; int floors,rooms,win,doors,restrooms,umet; char floortype[20]; char ti[20]; int woodfloor = 25;...
Arizona State University - CSE205 Assignment #9 Due Date Friday, March April 3rd, 5:30pm Important: This is an individual assignment. Please do not collaborate. No late assignment will be accepted. Make sure that you write every line of your code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report to the Dean's office. It must be submitted on-line (Course website). Go to "GradeScope" tab on Canvas -> CSE205...