Login

Contact Us
Homework
Homework Questions? Ask a Tutor for Answers ASAP
Not a Homework Question?
How JustAnswer Works:
Ask an Expert
Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
Get a Professional Answer
Via email, text message, or notification as you wait on our site.
Ask follow up questions if you need to.
100% Satisfaction Guarantee
Rate the answer you receive.
Ask Ingo U Your Own Question
Ingo U
,
Software Engineer
Category:
Homework
Satisfied Customers:
755
Experience:
Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Type Your Homework Question Here...
Ingo U is online now
There are many lottery schemes available across the world.
Customer Question
There are many lottery schemes available across the world. Write a MIPS Assembly language
program that will calculate the odds of winning the Jackpot prize.
For example:
o The Euro Millions lottery requires matching 5 numbers from a pool of 50
numbers and matching 2 numbers from a second pool of 11 numbers.
o The Mega Millions lottery requires matching 5 from 75 and 1 from 15.
o The Thunderball lottery requires matching 5 from 39 and matching 1 from 14.
o The PowerBall lottery requires matching 5 from 69 and 1 from 26.
o The Lotto lottery requires matching 6 from 59.
The subroutine example on the following page, calculates the Factorial of an input integer.
Starting with the code in the example, write a correct program in MIPS  QtSpim assembly
language that:
1) Calculates the odds of winning any of the lottery jackpot grand prizes.
2) The calculated value is to be displayed on the QtSpim console screen with an
appropriate commentary text. Such as “The odds are 1 in nnnn.”
3) The program is to accept as input:
An integer representing the large pool of possible numbers.
A second integer representing the count of numbers to be selected from
the large pool.
An integer representing the size of the second pool of numbers.
A fourth integer representing the count of numbers to be selected from the
second pool.
4) Test your program by calculating the odds of choosing a set of 2 numbers from
a pool of 6 numbers. The value is “1 in 15”. Test other combinations.
Note: Because the largest MIPS single precision integer value will not hold the value of more
than 12!, you will need to use some algebra to simplify the calculations. With the
simplifications, all of the math can be done using the integer multiply and divide instructions.
Your program should display a message when it stops.
Use the System Service calls on page A44 of the textbook for the input and output.
The work products of this assignment are:
1) A copy of the source program text file.
2) Screen captures showing test output results.# ***** n, in register $a0;
# ***** n! and stores the result in register $v0
factrl: sw $ra, 4($sp) # ***** the return address
sw $a0, 0($sp) # ***** the current value of n
addi $sp, $sp, 8 # ***** stack pointer
slti $t0, $a0, 2 # ***** 1 iteration, n=0 or n=1; n!=1
beq $t0, $zero, L1 # ***** calculate n(n1)!
addi $v0, $zero, 1 # *****=1; n!=1
jr $ra # ***** multiply
L1: addi $a0, $a0, 1 # ***** = n1
jal factrl # ***** (n1)!
addi $sp, $sp, 8 # ***** the stack pointer
lw $a0, 0($sp) # ***** saved (n1)
lw $ra, 4($sp) # ***** return address
mul $v0, $a0, $v0 # ***** (n)*(n1)
jr $ra # ***** value n!
# ***** Snyder 16 May 2016
######### ***** of the subroutine
Submitted:
6 months ago.
Category:
Homework
Share this conversation
Expert:
Ingo U
replied 6 months ago.
THIS ANSWER IS LOCKED!
You need to spend $3 to view this post.
Add Funds
to your account and buy credits.
Ask Your Own Homework Question
Share this conversation
Related Homework Questions
Question
Date Submitted
I have a column that divides j/s. This sometimes results in
1/16/2017
1/16/2017
HomeworkPete
Translate the sentence below into English. Pienso que nunca
1/8/2017
1/8/2017
Lane
I need help with my preexam for Penn high school this is
12/30/2016
1/4/2017
Wiz of All
NOT GLENN NOR F. NAZ PLEASE In the story titled "Macbeth" by
12/29/2016
12/29/2016
Manal Elkhoshkhany
Exam Number: 986159RR
12/26/2016
1/15/2017
GLENN
Need help with a couple assignment questions
12/24/2016
12/24/2016
StructuralEng
FOR LogicPro Only, I have another database question. Its a
12/19/2016
12/20/2016
LogicPro
Convert any of your earlier programs that use message boxes
12/15/2016
1/13/2017
LogicPro
Read the Funeral Oration of Pericles in the Ancient History
12/14/2016
12/16/2016
Donna Kakonge
Ineed help with chemstry exams, i have a few exams that i
12/14/2016
12/14/2016
GLENN
X
Ask a Tutor
Get a Professional Answer. 100% Satisfaction Guaranteed.
59 Tutors are Online Now
Type Your Homework Question Here...
characters left: