Question: 1. Write a Java program using the following hints. (i) Create an HashMap object called Musicallnstrument to add a key and its value. (2 Marks)

1. Write a Java program using the following hints. (i) Create an HashMap object called Musicallnstrument to add a key and its value. (2 Marks) //Key is an Instrument name and value is an Instrument Price. (ii) Write a java program using HashMap(use above Musicallnstrument) and implement two methods add Instrument and search Instrument (2 Marks) // Use your own class name. 2. Create a project Heater using Bluej (4 Marks) (i) Create a class Coffee that contains 2 fields coffeeType of type String and coffeePrice of type double. (ii) Define a constructor that takes no parameters, in the Coffee class, and set the coffeeType to arabicCoffee and coffeePrice to 15.5 respectively. (iii) Define an Accessor method showDetails() to display the class data. Define a Mutator method updatePrice() to change the price of the coffee. (iv) Create 2 objects T1 and T2 of the Coffee class and call its methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
