subject

Write a method named betonce that takes a console scanner and an integer as parameters and that allows the user to make a bet about the integer. the bet involves guessing whether a number between 1 and 36 is in the lower half of the range (1 through 18) or the upper half of the range (19 through 36). it will also be possible for the number to be 0, in which case the user always loses. these rules are used in a game called roulette. your method will be passed a scanner that can be used to read input from the user and it will be passed the number that the user is betting on. for example, the main method might look like this:

scanner console = new scanner(system. in);
random r = new random();
int number = r. nextint(37);
betonce(console, number);

your method should prompt the user for which bet they want to make and should then report the
number and whether the user won or lost. for example, below is a log of execution where the user enters "1" to bet on the low range:
do you want to bet on 1) low or 2) high? 1
the number was 1
you win
below is a log where the user enters "2" to bet on the high range:
do you want to bet on 1) low or 2) high? 2
the number was 11

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:30, Cocco
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
image
Computers and Technology, 24.06.2019 07:30, isabelgalvarado2838
Jason is working on a microsoft excel worksheet and he wants to create a print preview shortcut. his teacher asks him to access the customization option to create the new shortcut. which two tabs should jason select to place the print preview shortcut on the worksheet toolbar? a. new tab (custom) and new group (custom) b. new file tab (custom) and new tab (custom) c. new custom group and new command d. new custom tab and new command
Answers: 2
image
Computers and Technology, 25.06.2019 06:30, twistedhyperboles
How are slides deleted from a presentation?
Answers: 1
image
Computers and Technology, 25.06.2019 10:30, coco4937
How do you transfer an image onto a computer
Answers: 2
You know the right answer?
Write a method named betonce that takes a console scanner and an integer as parameters and that allo...

Questions in other subjects:

Konu
History, 29.11.2021 19:30