NEED HELP IN JAVA PROGRAMMING. "ENCAPSULATION" SHOULD BE IMPLEMENTED IN THE CODE. PLEASE FOLLOW INSTRUCTIONS AND REFER TO THE PICTURE BELOW FOR THE SAMPLE OUTPUT AND EXPLANATION.
NEED HELP IN JAVA
"ENCAPSULATION"
Instructions
1. Create a program that will simulate a mango store.
2. First create the class Fruit see the representation of the class.
3. Second create the class FruitTester see the representation of the class.
4. You will not ask the user to enter the name, price and color of the fruit. Give them a static
value using mutator methods.
5. Aside from the accessor and mutator, create a user defined method name calculatePrice( )
that will calculate the total price the user needs to pay. Formula (quantity * price).
6. Also create a user defined method name calculateChange( ) that will calculate the change
of the user. Formula (cash - totalPrice).
Note: You can create a validation that if the cash entered by the user is lower than the
totalPrice.
7. When printing the values invoke the accessor methods and the user-defined methods.
Step by step
Solved in 5 steps with 3 images