NaoDesu

MP

Mar 9th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MP{
  4.     public static void main(String[] args){
  5.         Scanner input = new Scanner(System.in);
  6.         String name;
  7.         String phone_num;
  8.         String address;
  9.        
  10.         System.out.println("Welcome To Pizza Hot");
  11.        
  12.         System.out.println();
  13.         System.out.println("Please choose Size of Pizza: ");
  14.         System.out.println();
  15.         option1();
  16.        
  17.         System.out.println();
  18.         System.out.println("Please choose Type of Pizza: ");
  19.         System.out.println();
  20.         option2();
  21.        
  22.         System.out.println();
  23.         System.out.println("Please choose your drink: ");
  24.         System.out.println();
  25.         option3();
  26.        
  27.         System.out.println();
  28.         System.out.println("Please enter your name: ");
  29.         name = input.nextLine();
  30.        
  31.         System.out.println();
  32.         System.out.println("Please enter your phone number: ");
  33.         phone_num = input.nextLine();
  34.        
  35.         System.out.println();
  36.         System.out.println("Please enter your address: ");
  37.         address = input.nextLine();
  38.        
  39.         System.out.println();
  40.         System.out.println("We will keep your track order from the information!");
  41.         System.out.println("Your name: "+name);
  42.         System.out.println("Your name: "+phone_num);
  43.         System.out.println("Your name: "+address);
  44.         System.out.println("Thank you! Please come again!");
  45.    
  46.     }
  47.    
  48.     public static double option1(){
  49.         Scanner input = new Scanner(System.in);
  50.         double result;
  51.         double size = 0;
  52.        
  53.         System.out.println("1-Small");
  54.         System.out.println("2-Regular");
  55.         System.out.println("3-Large");
  56.         System.out.println();
  57.         System.out.println("Please enter your choice: ");
  58.        
  59.         result = input.nextDouble();
  60.        
  61.         if(result==1){
  62.             System.out.println();
  63.             System.out.println("Small size is selected ");
  64.             return size=1;
  65.         }
  66.         else if(result==2){
  67.             System.out.println();
  68.             System.out.println("Small size is selected ");
  69.             return size=2;
  70.         }
  71.         else if(result==3){
  72.             System.out.println();
  73.             System.out.println("Large size is selected ");
  74.             return size=3;
  75.         }
  76.         else if(result>3){
  77.             System.out.println();
  78.             System.out.println("Invalid size! ");
  79.  
  80.         }
  81.         return size;
  82.     }
  83.    
  84.     public static double option2(){
  85.         Scanner input = new Scanner(System.in);
  86.         double result;
  87.         double type = 0;
  88.        
  89.         System.out.println("1-Chicken");
  90.         System.out.println("2-Beef");
  91.         System.out.println("3-Fish");
  92.         System.out.println();
  93.         System.out.println("Please enter your choice: ");
  94.        
  95.         result = input.nextDouble();
  96.        
  97.        
  98.         if(result==1){
  99.             System.out.println();
  100.             System.out.println("Chicken type is selected ");
  101.             return type=5.00;
  102.         }
  103.         else if(result==2){
  104.             System.out.println();
  105.             System.out.println("Beef type is selected ");
  106.             return type=5.00;
  107.         }
  108.         else if(result==2){
  109.             System.out.println();
  110.             System.out.println("Fish type is selected ");
  111.             return type=5.00;
  112.         }
  113.         else if(result>3){
  114.             System.out.println();
  115.             System.out.println("Invalid type! ");
  116.             option2();
  117.         }
  118.         return type;
  119.     }
  120.    
  121.     public static void option3(){
  122.         Scanner input = new Scanner(System.in);
  123.         double result;
  124.  
  125.         System.out.println("1-Cola");
  126.         System.out.println("2-Milo");
  127.         System.out.println("3-Pepsi");
  128.         System.out.println("4-No drink");
  129.         System.out.println();
  130.         System.out.println("Choose your drinks: ");
  131.        
  132.         result = input.nextDouble();
  133.        
  134.         if(result==1){
  135.             System.out.println();
  136.             System.out.println("Cola drink is selected ");
  137.         }
  138.         else if(result==2){
  139.             System.out.println();
  140.             System.out.println("Milo drink is selected ");
  141.         }
  142.         else if(result==3){
  143.             System.out.println();
  144.             System.out.println("Pepsi drink is selected ");
  145.         }
  146.         else if(result==4){
  147.             System.out.println();
  148.             System.out.println("No drink ordered ");
  149.         }
  150.         else if(result>4){
  151.             System.out.println();
  152.             System.out.println("Invalid type!");
  153.             option3();
  154.         }
  155.        
  156.     }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment