Build a class named roulette

Assignment Help JAVA Programming
Reference no: EM131586228

Assignment

Build a class named Roulette with 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. Similar rules are used in a game called Roulette.

The betOnce 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.

Then build a driver class (named whatever you would like) that creates and uses an instance of the other class in order to play the game. The main method will look something like this:

Scanner in = new Scanner(System.in); Random r = new Random();
int number = r.nextInt(37); [objectname].betOnce(in, number);

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 You lose

You may assume that your method is always passed a number between 0 and 36. Remember that the user always loses when the number is 0.

Reference no: EM131586228

Questions Cloud

Flotation costs cost of common equity : Last year dividend 3.33 Growth rate of dividends 4.5% Selling price of stock 38.08 Flotation costs 4.86 Cost of common equity?
Write a generic class pair which has 2 type parameters : Write a generic class Pair which has 2 type parameters, F and S, representing the type of the first and second elements of a pair respectively
Discuss the desired outcomes of your organization : Discuss the desired outcomes of your organization.Discuss the importance of identifying the organization's goals and objectives .
Explain the intended purpose of each erp and models : Explain intended purpose of each ERP and models, a list and description of each associated models and pricing, and other relevant technical and functional data.
Build a class named roulette : CS 1400 - Hilton - Build a class named Roulette with a method named betOnce that takes a console Scanner and an integer as parameters
Net present value : You have to find the NPV for the company's project, assuming the companies cost of capital is 7.18%. The initial outlay for the project
What is the current price of the bond : The bond has the maturity of 24 years and the yield to maturity of 11.41% compounded semiannually. What is the current price of the bond?
Are they clear enough to define roles of organizations : Have the strategies enacted since 2001 clearly articulated the transition from the posture adopted during the Cold War to that required for non-state threats .
Explain the use of third parties for logistical purposes : Explain the use of third parties for logistical purposes. Describe how the relationship with the suppliers will be managed.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd