Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

simple Java program 5

BunkerHillBroad
BunkerHillBroad 


use file TwoRandom.java Write a Java program that generates two “random” integers using the method Math.random(), each between 1 and 7 (inclusive). Your program should output the two numbers, and one of the following three messages: • A tie! • You lose! • You win! if the difference between the numbers is zero if the difference between the numbers is 1, 3, or 5 if the difference between the numbers is 2, 4, or 6 Attachments
Tags Clarifications

Answers

Solution for TwoRandom java

mariobeka
mariobeka 



Below the solution for this assignment. Attachments
TwoRandom.java (1 K) Download Preview
number2 = 1 + (int) (Math.random() * ((7 - 1) + 1)); int difference = Math.abs(number1 - number2); if (difference ==

Screenshots
Purchase Answer