Iam_Sandeep

Untitled

May 9th, 2023
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. public class Juice extends MenuItem {
  2.     private String fruits;
  3.  
  4.     public Juice(String name, double price, String fruits) {
  5.         super(name, price);
  6.         this.fruits = fruits;
  7.     }
  8.  
  9.     @Override
  10.     public boolean isServedHot() {
  11.         return false;
  12.     }
  13.  
  14.     @Override
  15.     public String toString() {
  16.         return super.toString() + ", Fruits: " + fruits;
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment