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

The subroutine example on the following page, calculates the

Customer Question

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 - SPIM assembly language that: 1) Calculates the odds of winning the Power Ball grand prize jackpot. 2) The calculated value is to be displayed on the SPIM screen with the appropriate commentary text. Such as “the odds are 1 in nnnn.” 3) Test your program by calculating the odds of choosing a set of 3 numbers from a set of 7 numbers. 4) 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. 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 the math can be done using the integer multiply. Additionally, it is expected that your program will handle correctly only a small subset of all the possible probability / odds calculations. You can use the fact that the number of balls selected will be less than 12, and that you can use the provided factorial subroutine. Use the System Calls on page A-44 for the input and output. The work products of this assignment are: 1) A copy of the source program. 2) Screen captures showing the output results. [ 150 points ] pfctrl: 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 =1;n!=1 beq $t0, $zero, L1 # ***** calculate n(n-1)! addi $v0, $zero, 1 # *****=1; n!=1 jr $ra # ***** multiply L1: addi $a0, $a0, -1 # ***** := n-1 jal pfctrl # ***** (n-1)! addi $sp, $sp, 8 # ***** the stack pointer lw $a0, 0($sp) # ***** saved (n-1) lw $ra, 4($sp) # ***** return address mul $v0, $a0, $v0 # ***** (n)*(n-1) jr $ra # ***** value n!

Do you have any information about the simplifying algebra that is mentioned? I can most likely write the MIPS code but I haven't dealt with the "n choose k" algebra in a while. I know the formula is n! / (k! (n-k)!), but can't quite remember the simplifying tricks.

Also, could you upload the original document you pasted above?

Sometimes pasting formatted data directly into this site doesn't render as you'd expect, and can become difficult to read. I'm not sure I got all the information correctly and completely.

I'm not sure but below I have pasted some discussion threads from other people doing the project :___________________________________________________________________________________________________Many of your questions can be answered by going to the PowerBall website: http://www.powerball.com/Additionally, your program needs to be general enough to calculate the 'odds' of other choose K from N problems.This exercise expects that you will do some independent research as part of your solution. ___________________________________________________________________________________________________The mathematics behind the PowerBall and other lotteries is the possibilities of choosing a set of K objects from a set of N objects. The solutions require calculating factorial values. N choose K is a well known problem in combinational math.This programming assignment is for you to write a program, using factorial calculations, that calculates the number of sets given N objects, choosing K of them. The Powerball ‘odds’ is a specific case. Your program is to be general enough that it will correctly calculate when given input values in the range of N less equal 60, and K less equal 11.Your testing should include small numbers so that you can prove to yourself that your program solution is correct. 6 choose 2 equals 15; for example and then 7 choose 3 equals 35.You can 'hardcode' the red ball value = 35. ___________________________________________________________________________________________________ The program that you are to write is to use the "old" Powerball game. The problem was written Before the Powerball game was changed in October.Sorry about that.There are just two input values. N the value of the large pool of numbers, and K the count of numbers to be chosen.See also the other discussion thread.

I also use MARS at times, which is a little different... that vast majority of the assembly code will be the same either way, but please let me know which one you use, so I can make sure my solution works for you.

THIS ANSWER IS LOCKED! You can view this answer by clicking here to Register or Login and paying $3. If you've already paid for this answer, simply Login.