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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started