Write a program that uses the Purchase class in Listing 5.13 to set the following prices: Oranges:

Question:

Write a program that uses the Purchase class in Listing 5.13 to set the following prices:

Oranges: 10 for $2.99

Eggs: 12 for $1.69

Apples: 3 for $1.00

Watermelons: $4.39 each

Bagels: 6 for $3.50

Then calculate the cost of each of the following five items and the total bill:

2 dozen oranges

3 dozen eggs

20 apples

2 watermelons

1 dozen bagels


Listing 5.13

import java.util.Scanner; /** Class for the purchase of one kind of item, such as 3 oranges. Prices are set supermarket style, such as 5 for $1.25. */ public olass Purchase private String nam private int groupCount; e; //Part of a price, like the 2 in //2 for $1.99. //Part of

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: