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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 11:30
Which excel file extension stores automated steps for repetitive tasks?
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
question
Computers and Technology, 24.06.2019 14:40
Create a function (prob3_6) that will do the following: input a positive scalar integer x. if x is odd, multiply it by 3 and add 1. if the given x is even, divide it by 2. repeat this rule on the new value until you get 1, if ever. your program will output how many operations it had to perform to get to 1 and the largest number along the way. for example, start with the number 3: because 3 is odd, we multiply by 3 and add 1 giving us 10. 10 is even so we divide it by 2, giving us 5. 5 is odd so we multiply by 3 and add one, giving us 16. we divide 16 (even) by two giving 8. we divide 8 (even) by two giving 4. we divide 4 (even) by two giving 2. we divide 2 (even) by 2 to give us 1. once we have one, we stop. this example took seven operations to get to one. the largest number we had along the way was 16. every value of n that anyone has ever checked eventually leads to 1, but it is an open mathematical problem (known as the collatz conjectureopens in new tab) whether every value of n eventually leads to 1. your program should include a while loop and an if-statement.
Answers: 3
You know the right answer?
Write a method named betonce that takes a console scanner and an integer as parameters and that allo...
Questions
question
Geography, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
question
Social Studies, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
question
History, 27.11.2021 01:00
question
Mathematics, 27.11.2021 01:00
Questions on the website: 13722360