Question: IN JAVA LANGUAGE PLEASE Problem : Write a program that plays the game Price IS Right. here is the pseudocode for the game: While (people
IN JAVA LANGUAGE PLEASE
Problem: Write a program that plays the game Price IS Right. here is the pseudocode for the game:
While (people want to play) {
fill the array of items by reading from the text file fill the array of names by reading from the text file
//some of your code
While there are players left on the list
{
fill the array of items by reading from the text file
fill the array of names by readin from the text file //some of your code
while there are players left on the list
{
4 people will be selected randomly from the list of the players, these four people must be remove from the list An item from the list of the items will be selected randomly. This item must be removed from the list of the items
Each player is prompted to enter a bid The player with the closest bid to the actual price without going over will win. If the bids of all the players are less than or equal to the actual price
{ Same players will play again
A new item will be selected (this item must be removed from the list }
else
Requirements:
{ If there are enough players left on the list
All The selected players with the higher bid than the actual price will be Replaced If the numbers of the replace players is less than 4
}
} Do you want to play again? }
New item must be selected.
You can create your own design as long as you have break down the problem in multiple methods. (6 or more methods)
Study chapter 6 so that you can read from a file.
Create two text files using notepad. One file will contains the name of the people (20) who
might be selected to play. The other file will contains a list of the items (20) along with the price for each item. So the format for the file should be :
34 keyboard
600 laptop
Create a method that reads the names from the text file and store them in an array.
Create a method that reads the list of the items in the file and store them in an array.
Write a method that select four names randomly from the array that you just filled in. the
selected names will be stored in an array with the length 4.
Write a method that selects a random item from the array that you created.
Write a method that displays the selected item. Also this method will get the players bids and
stores them in an array called bids. The size of this array is 4
Write a method called priceIsRight that accepts the array of the players bids, the actual price of
the item. This method finds the bid closest to the price of the item. and returns the index of the
best bid
This method displays all the bids made by the player, the price of the item and the winner of the
play.
Your main method should have only one method celled start.
Write a method that checks and see if there are any players left in the array name.
Start method will contain all the declarations, and method calls.
a. You need to declare multiple arrays such as the followings:
String[] names
String[] items
iii. Double[bids] iv. String[] players
Notes:
The selected players must be unique at each round of the game. For example you cannot have Joe Alex Joe Mary as the players. You must make sure that you are not selecting a person who is already selected.
The description method must be very descriptive and must explain the rules of the game. . Please do not copy it from the sample output.
Create a text file with at least 20 names in it.
Create another text files with at least 20 items in there. This file will contain the item price and
items name
Your output must be similar to the provided output. Meaning that all the prompts must be the
same.
Must use printf to output the final result so that you have a nice format.
Must create your own text files of items and names
Refer to the file output.txt for the sample output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
