Menu

[Solved]Java One Games Awesome Tv Show History Price Right Involves Trying Guess Five Digits Make Q37281360

In Java:

One of the games in the most awesome TV show in history, “ThePrice is Right,” involves trying to guess the five digits that makeup the price of a car.

For example, if the car’s price is $23,150, the user tries toguess those digits. If their guess was $20,500, they would have twodigits correct: the first digit (2) and the fifth digit (0). Thegame would then tell them that they have two digits right.

Write a class to simulate this game. The class needs to have anarray of five integers that hold the car’s price; you can set theprice of your own choosing in your constructor. The class alsoneeds a method that has to accept an array of five integers thatrepresents the contestant’s guess at the car price. That methodthen compares corresponding elements in the two arrays, and returnsthe number of digits that match. In addition, write a method thatdisplays the price.

Demonstrate the class in a separate program that asks the userto enter their five number guess. The program then lets thecontestant know how many digits match. If all 5 digits match, givea special message to the user that they’ve also won a grand pricebecause they guessed perfectly.

Important: name your class “CarGame” and yourdemo program’s class “CarGameDemo”.

Expert Answer


Answer to In Java: One of the games in the most awesome TV show in history, “The Price is Right,” involves trying to guess the fiv… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *