Assembly Language Programs using QtSpim Project

Description

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 checks if a customer is a member or not, and reads in their purchased amount, and gives discounts accordingly. 
If a customer is a member and their purchased amount is less than or equal to 9000, then the customer gets 10% discount, i.e., their payment will be their purchased amount * (0.9). If a customer is a member and their purchased amount is greater than 9000, then the customer gets 10% discount and also a discount of 200, i.e., their payment will be their purchased amount * (0.9) – 200. If a customer is not a member, there is no discount.

Name your source code file Assignment4.s.
The following shows how it looks like in a C program:
 int membership;

 int purchasedAmount;

 int payment =0;

 printf(“Are you a store member? Enter 1 for a member, 0 for a non-membern”);

 //read an integer from a user input and store it in membership

 scanf(“%d”, &membership);

 if (membership !=0 && membership != 1)

 {

   printf(“Invalid Answer.”);

 }

 else

 {

 printf(“Enter your purchase amount in cents:n”);

 //read an integer from a user input and store it in purchasedAmount

 scanf(“%d”, &purchasedAmount);

 

   if (membership == 1 && purchasedAmount <= 9000)    {       payment = purchasedAmount - purchasedAmount/10;    }    else if (membership == 1 && purchasedAmount > 9000)

   {

      payment = purchasedAmount – purchasedAmount/10 – 200;

   }

   else if (membership == 0)

   {

      payment = purchasedAmount;

   }

   //print out the payment

   printf(“Your total payment is %d n”, payment);

 } //end of else 
Here is a sample output (user input is in bold):
Are you a store member? Enter 1 for a member, 0 for a non-member
1
Enter your purchase amount in cents:
30000
Your total payment is 26800
———————————————–
Here is another sample output (user input is in bold):
———————————————–
Are you a store member? Enter 1 for a member, 0 for a non-member
0
Enter your purchase amount in cents:
50010
Your total payment is 50010
———————————————–
Here is another sample output (user input is in bold):
———————————————–
Are you a store member? Enter 1 for a member, 0 for a non-member
1
Enter your purchase amount in cents:
9000
Your total payment is 8100
———————————————–
Here is another sample output (user input is in bold):
———————————————–
Are you a store member? Enter 1 for a member, 0 for a non-member
3
Invalid Answer.

1 attachmentsSlide 1 of 1attachment_1attachment_1

Tags:
decision making

QtSpim

ASSEMBLY LANGUAGE PROGRAMS

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Reviews, comments, and love from our customers and community:

Article Writing

Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more.

Mary J.

Student

Essay (Any Type)

On time, perfect paper

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. Transparent

Arnold W.

Customer

Coursework

Perfect!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>