Question: In Java Create a class named Price, this class contains three private fields: price, quantity, couponvalue Methods to get and set each of the fields
In Java
Create a class named "Price", this class contains three private fields: price, quantity, couponvalue Methods to get and set each of the fields one constructor with three parameters, these three parameters can initialize price, quantity and coupon value as specified (for instance, 20, 10, 5) computeprice() method with three parameters, they represent the price of a meal, the quantity ordered and a coupon value. Multiple the price and quantity, reduce the result by the coupon value, and then add 20% tip and return the total price. The class should contain a main() method which tests constructor method, get and set methods, and computeprice() methoduse system.out.println() to show different results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
