Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exercise 12.2 Write a program that

Similar presentations


Presentation on theme: "Exercise 12.2 Write a program that"— Presentation transcript:

1 Exercise 12.2 Write a program that
Creates an Item instance named Tuna with price $2.45 Purchases 200 units for a total of $250 Sells 50 units Sells 25 units for a total of $30 Purchases 100 units for a total of $175 Outputs unit cost price

2 Exercise 12.3 Write a program that
Creates a Fresh instance called “Pacific Salmon”, with any item number, a price of $20, and an expiry date three weeks from now Creates a Fresh instance called “Atlantic Salmon”, with the same item number as above, a price of $25, and an expiry date 20 days from now Outputs the return of the equals method invoked on one passing the other as argument Outputs the return of the toString method for the two items

3 Exercise 12.4 Contact x = new Client (“Adam”, “Toronto”, “AA-”);
The object reference x was declared and assigned as follows Write a code fragment that changes the credit rating to AA Contact x = new Client (“Adam”, “Toronto”, “AA-”);

4 Exercise 12.6 Write a program that
Creates an Item instance named Tuna with price $2.45 Creates a Supplier instance named “Adam” with any address such that it supplies the above item at $1.75 a unit

5 Exercise 12.9 Starting from a randomly chosen inventory collection, write a program that lists the fresh items and their expiry dates

6 Exercise 12.17 Starting from a randomly chosen contacts collection, write a program that determines whether any item has more than one supplier


Download ppt "Exercise 12.2 Write a program that"

Similar presentations


Ads by Google