# Calculations
lw $s1,tip # get tip rate
lw $s2,tax # get tax rate
addu $s3,$s1,$s2 # total rate
mul $s4,$s0,$s3 # 100*(tax + tip)
div $s4,$s4,100 # tax + tip
addu $s5,$s0,$s4 # total bill
The final section of the program writes the results to the monitor.
## Register Use:
##
## $s0 meal cost
## $s1 tip rate
## $s2 tax rate
## $s3 total rate
## $s4 tax+tip dollars
## $s5 total bill
# Output
____ $v0,4 # print string
____ $a0,head1 # "tax plus tip"
syscall
____ $a0,$s4 # get tax+tip
li $v0,1 # print integer
syscall #
____ $v0,4 # print string
____ $a0,head2 # "total cost"
syscall
____ $a0,$s5 # get total
____ $v0,1 # print integer
syscall #
li $v0,10 # exit
syscall
.data
tip: .word 15 # tip rate in percent
tax: .word 8 # tax rate in percent
prompt: .asciiz "Enter food cost: "
head1 : .asciiz " Tax plus tip: "
head2 : .asciiz "\n Total cost: "