You must write a small application in JAVA for items and their prices. Your program must:

  1. Create an array of item names. Use the following item names: Bread, Milk, Butter, Chips, Honey, Soap, Towel, Carrots, Beans, Samp, Dress, Pants, Shoes, Socks.
  2. Create an array of item prices. Use the following item prices: 15.50, 12.00, 56.00, 20.00, 45.00, 7.00, 75.00, 8.00, 5.00, 12.00, 200.00, 150.00, 400.00, 25.00.
  3. Display every item name and its corresponding price. See the sample output given.
  4. Print the average price of all the items.
  5. Find and display the price of a specific item
    a. Read in the name of the item.
    b. Loop through the items array and look for the specific item.
    c. If the item is found, display the price of the item.
SAMPLE OUTPUT
Display every item name and its corresponding price.
Items in stock with prices

Bread - R15.5
Milk - R12.0
Butter - R56.0
Chips - R20.0
Honey - R45.0
Soap - R7.0
Towel - R75.0
Carrots - R8.0
Beans - R5.0
Samp - R12.0
Dress - R200.0
Pants - R150.0
Shoes - R400.0
Socks - R25.0

Display the average price of all the items
The average price of all the items is R73.0

Find and display the price of a specific item – Sample input and output
Sample run 1
Sample run 2
Item Look-up
What item are you looking for?
Dress
The price of item Dress is R200.0
Item Look-up
What item are you looking for?
hjgjg
Item hjgjg is not stocked in the shop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.