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

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!