Question: (Java) Write a program that displays the two most expensive items in a wish list Overview: Using your newly found Java looping skills, write a

(Java) Write a program that displays the two most expensive items in a wish list

Overview:

Using your newly found Java looping skills, write a program that asks the user for a number and then asks the user for that many wish list items (each with a name and a cost). Print out the two most expensive items on the wishlist.

Setup:

Create a class (.java) file called WishList.java

(This can be within a project that contains the other parts of this homework or it can be in separate project on its own)

Features:

ask the user: How many items do you want in your wish list?

if they enter a number less than 2, default the number to 2

ask the user ^^^^ for that many items

ask for a name

ask for a cost

print out the name and cost of the two most expensive items

Example Output

How many items do you want in your wish list?

> 3

What's the name of item 1?

> walrus

How much does it cost?

> 45000

What's the name of item 2?

> pizza

How much does it cost?

> 15

What's the name of item 3?

> submarine

How much does it cost?

> 120000

The most expensive items were: submarine - $120000.00 walrus - $45000.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!