Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need code in java please! Programming Assignment - Fish Store In this assignment you will practice: 1. reading input from the keyboard 2. writing expressions

need code in java please!
image text in transcribed
image text in transcribed
Programming Assignment - Fish Store In this assignment you will practice: 1. reading input from the keyboard 2. writing expressions involving integers and real numbers 3. incorporating loops into a program 4. using formatted printing for output Description The Java Tropical Fish store is here to help you select the perfect tank for your tropical fish enjoyment. The first rule for setting up a nice, healthy fish tank is two gallons of water for every inch of fish in the tank. You must remember to consider the adult size of the fish. This means if you have 3 adult fish, and each fish is 3 " long, you need to have at least an 18 gallon tank. ( 3 fish 3 inches 2 gallons / fish =18 ) The second rule involves what sort of fish will live in the tank. If there are aggressive fish in the tank, then the tank should be sized 1.5 times larger than the previous caleulation. That is only an approximation, and in real life, you would have to carefully select your fish to make sure they get along well. But for this program, we will follow the two rules we just listed. Fish tanks ONLY come in 4 sizes in our store: 20,40,60 and 80 gallons. Your program should recommend to the user the next largest size that they need. For example, if you calculate that the user needs 45 gallons for their fish, your program should recommend a 60 gallon tank. If the fish would need a tank larger than 80 gallons, print out that the store does not sell a large enough tank. Start your program in main by deelaring variables and writing a loop. Then ask the user to enter the information for the fish they expect to place in the new tank, then suggest the correct size tank. For each fish, your code will ask the user: - What is the name of the fish type? (for example: goldfish) - What is the adult length of the fish type in inches? (for example: 2) - How many of this fish? (for example: 3 ) Ask the user to enter all of this information and loop around for as many different fish types as the user wants. When the user enters "done" for the fish type, the loop will exit and stop collecting data. Next ask your user if there are any aggressive fish in the group. Determine the best size tank based on the rules. If the user would need a tank bigger than 80 gallons, tell the user that we don't carry any bigger tanks. Write out a tank report, including a table showing the fish information, total fish, total length of fish, minimum required gallons and the appropriate tank. Here is a sample for 4 Clown Loaches, which are 3" long and 5 Neon Tetras, which are 1 " long. None of the fish are aggressive: Then ask the customer if he/she wants to calculate another fish tank, If the answer is yes, the program should run again. NOTE: This means that an outer loop is needed around the inner loop that collects the fish information! If the answer is no, drop out of the loop, and show your customer a good-bye message. Test Cases: You can use these test cases to verify that your program is giving you correct results. Test Case \#1 fish type = Clown Loach, number =4, size =3 fish type = Neon Tetra, number =5, size =1 Correct output \#1 Tropical Fish Store Tank Requirements Type of Fish Number Adult size Clown Loach Neon Tetra Aggressive: No Total Fish Length: 17 Tank Size: 40 gallons Test Case \#2 fish type = Zebra Danios, number =2, size =2 fish type - Cherry Barb, number =6, size =2 fish type = AngelFish, number =1, size =6 aggressive Correct output \#2 Tropical Fish Store Tank Requirements Type of Fish Number Adult Size Clown Loach Neon Tetra Aggressive: Yes Total Eish Length: 22n Tank Size: 80 gallons

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions