Starting from:
$30

$24

Lab 7 Bonus Solution

Tonight we will be drawing SuperLotto Plus numbers. Write a program that serves as a draw machine that draws 6 lucky numbers (i.e. randomly generate 6 lucky numbers). The rule of SuperLotto Plus numbers are: five lucky numbers from 1 to 47 and one MEGA number from 1 to 27. Print out these 6 lucky numbers.




Write a program that generates a random number between 1 and 20 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” If the use guessed the right number, the program should display “Yes, the secrete number is … You win!”. After the user guessed three but failed to reveal the secrete number, the program should display “Sorry, you lost! Buy.”




Testing requirements:

Test program 1 twice; Test program 2 at least 3 times and must include a user winning case. Create a script file capturing all test cases. Copy and paste the test results captured on script file to the end of your source code (i.e. the .java file) and use block comments (/* … */ ) to comment out the test results.





Submission:

Submit on blackboard source programs (*.java files with test results attached at the end of the program as block comment).









 

More products