Question: Q5) Write a Java program in BlueJ to perform the following: [2 Marks] a) Create a class shop with fields item1, item2, item3, billamount and

Q5) Write a Java program in BlueJ to perform the following: [2 Marks]

a) Create a class shop with fields item1, item2, item3, billamount and discount. Initialize discount= 5

b) Declare a method bill, to find the totalbill of items using the formula: (billamount * discount) /100.

c) Declare a parameterized constructor for the above class and set the billamount.

d) Declare one more parameterized constructor for the above class and set the discount to 6 using this keyword.

e) Calculate the totalbill by calling the method bill. Show the output using the program screenshots.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!