Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1.  
  2. /**
  3. * Creating Class McDonalds which inherits from parent class Resturant
  4. */
  5. public class McDonalds extends Restaurant
  6.  
  7. { /**
  8. *
  9. *instance Variables changes to global Variables
  10. */
  11. boolean hasPlayPlace=true;
  12. @Override
  13. public void Name()
  14. {
  15. System.out.println("Name of the Resturant");
  16. System.out.println("---------------------");
  17. System.out.println("McDonalds");
  18.  
  19. }
  20. /**
  21. * Method to restore total Price including 6% tax
  22. * Method to show menu items
  23. * Method to display Location of Restaurant
  24. * Method to display if the resturant has play place
  25. */
  26. public void totalPrice()
  27. {
  28. float bill,total,tax;
  29. bill=2250;
  30. tax= (6/100f);
  31. total= bill+(bill*tax);
  32.  
  33. System.out.println("Your Total Bill is: "+total);
  34. }
  35. public void menuItems()
  36. {
  37. System.out.println("McDouble\nGrilled Chicken Deluxe\nFrench Fries\nSandwiches\nMcDonald's apple pies\nMcRib\nMcDonald's Fries");
  38. }
  39. public void nameLocation()
  40. {
  41. System.out.println("Kamal Pokhari, Kathmandu");
  42. }
  43. public void hasPlayPlace()
  44. {
  45. if(hasPlayPlace==true)
  46. {
  47. System.out.println("Yes, we do have play palce");
  48. }
  49. else
  50. {
  51. System.out.println("Sorry, we do not have play place in this very time interval ");
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement