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
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 to. String method for the two items
Exercise 12. 4 • The object reference x was declared and assigned as follows Contact x = new Client (“Adam”, “Toronto”, “AA-”); • Write a code fragment that changes the credit rating to AA
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
Exercise 12. 9 • Starting from a randomly chosen inventory collection, write a program that lists the fresh items and their expiry dates
Exercise 12. 17 • Starting from a randomly chosen contacts collection, write a program that determines whether any item has more than one supplier