1. Engineering
  2. Computer Science
  3. please write in eclipse java please no buffered readers and...

Question: please write in eclipse java please no buffered readers and...

Question details

Please write in ECLIPSE JAVA. Please no buffered readers and please do not use Java’s built in data structures or data functionality (Like sorting and searching), however stuff like java.util.scanner and wild cards like java.io.* and java.util.* are fine, but please remember I am very much a beginner at this and would much rather understand the material instead of doing it the easier way using built-in data structures. It would also be nice if you could do it in the way that is suggested because I understand that way pretty well, however it's not critical. Thanks in advance.

Objective:

Write a program which emulates the final game of a famous price related game show. The program must read from a file (prizeList.txt) and populate an array of 50 prizes. Each item has an associate name and price, which is in the file and also in the order named. The name and price are separated by a tab. The program must then randomly pick 5 items out of that array for the showcase showdown, in which repeated items are allowed. Then, the program must prompt the user with the names (individual prices hidden) of the prizes that have been randomly selected and ask them to enter the total cost closest without going over. Since there is not another contestant in this version of the game, the program must also check to see if the price guessed is within $2,000 of the actual retail price or else they lose as well. The game will continue until the user chooses to quit.

Suggested Methodology

You can solve this in any number of ways, and here's a way you may take to approach this problem.

3 Classes

Prize: This is a simple class which holds a single item from the list provided. As such it has two instance variables prize and name, and also all the accessors, mutators, and constructors associated with it.

Showcase: A more complex class which holds the arrays for the entire prize list and the randomly prize array that is the showcase. Each array uses the type Prize. This class must populate the entire prize array upon its construction from the file. Also the file contains each prize name and cost separated by a tab. A method for populating the showcase by randomly selecting items from the prize list is strongly recommended.

ShowcaseGame: This is the entire front end of the game. All of the users input and the prompts should go in this class which contains nothing more than a main method.

Example Dialog:

Welcome to the showcase show down!

Your prizes are:

milk

bread

car

car

car

You must guess the total cost of all without going over

Enter your guess

60000

You guessed 60000.0 the actual price is 60012.0

Your guess was under! You win!

Would you like to play again? Enter 'no' to quit

yes

Welcome to the showcase show down!

Your prizes are:

moose

boat

bread

bread

bread

You must guess the total cost of all without going over

Enter your guess

40000

You guessed 40000.0 the actual price is 51021.0

I'm sorry but that guess was bad. You lose for being bad.

Would you like to play again? Enter 'no' to quit

yes

Welcome to the showcase show down!

Your prizes are:

milk

moose

cheese

cheese

boat

You must guess the total cost of all without going over

Enter your guess

200000

You guessed 200000.0 the actual price is 51015.0

I'm sorry but that was over... You get nothing

Would you like to play again? Enter 'no' to quit

no

Goodbye

Here is the contents of the text file "prizeList.txt"

Car     20000
Boat    50000
Moose   1000
Goat    200
Shredded wheat 2
Cheese  5
Milk    5
Bread   7
Big TV  1000
Life time supply of Cheetos     2000
Lamp    20
Blender 30
Food Processor  40
Camera  400
Watch   750
Beard Supplies  800
Trip to Latvia  4000
Ski Equipment   1200
Pair of Scooters        2000
A basket of turtles     20
Fiber Supplement        6
Handful of hard candy   2
Large Ball of Foil      5
Heap of Makeup  100
A Pet Crow      50
A Trunk Full of Shoes   500
Trip to New Zealand     5000
Robosaurus      100000
Espresso Making Ferrets 1200
Antacid 5
A box of slightly used magazines        1
Pinball Machine 1500
Jar of Tomato Paste     5
Aspirin 8
Unreasonable amount of luncheon meat    200
Dinette Set     1400
Bedroom Set     1600
Washer and Dryer        1500
Microwave       30
Latest Video Game Console       500
Globe that lights up!   400
A sparkly necklace      800
Tennis Equipment        500
Cereal  4
The Antidote    250000
Ping Pong Table 400
A Very Very Pretty Ring 1200
Guitar  1500
Banjo   120
Exotic Plants   500
A Large Cowboy Hat      100
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution