Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MP{
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- String name;
- String phone_num;
- String address;
- System.out.println("Welcome To Pizza Hot");
- System.out.println();
- System.out.println("Please choose Size of Pizza: ");
- System.out.println();
- option1();
- System.out.println();
- System.out.println("Please choose Type of Pizza: ");
- System.out.println();
- option2();
- System.out.println();
- System.out.println("Please choose your drink: ");
- System.out.println();
- option3();
- System.out.println();
- System.out.println("Please enter your name: ");
- name = input.nextLine();
- System.out.println();
- System.out.println("Please enter your phone number: ");
- phone_num = input.nextLine();
- System.out.println();
- System.out.println("Please enter your address: ");
- address = input.nextLine();
- System.out.println();
- System.out.println("We will keep your track order from the information!");
- System.out.println("Your name: "+name);
- System.out.println("Your name: "+phone_num);
- System.out.println("Your name: "+address);
- System.out.println("Thank you! Please come again!");
- }
- public static double option1(){
- Scanner input = new Scanner(System.in);
- double result;
- double size = 0;
- System.out.println("1-Small");
- System.out.println("2-Regular");
- System.out.println("3-Large");
- System.out.println();
- System.out.println("Please enter your choice: ");
- result = input.nextDouble();
- if(result==1){
- System.out.println();
- System.out.println("Small size is selected ");
- return size=1;
- }
- else if(result==2){
- System.out.println();
- System.out.println("Small size is selected ");
- return size=2;
- }
- else if(result==3){
- System.out.println();
- System.out.println("Large size is selected ");
- return size=3;
- }
- else if(result>3){
- System.out.println();
- System.out.println("Invalid size! ");
- }
- return size;
- }
- public static double option2(){
- Scanner input = new Scanner(System.in);
- double result;
- double type = 0;
- System.out.println("1-Chicken");
- System.out.println("2-Beef");
- System.out.println("3-Fish");
- System.out.println();
- System.out.println("Please enter your choice: ");
- result = input.nextDouble();
- if(result==1){
- System.out.println();
- System.out.println("Chicken type is selected ");
- return type=5.00;
- }
- else if(result==2){
- System.out.println();
- System.out.println("Beef type is selected ");
- return type=5.00;
- }
- else if(result==2){
- System.out.println();
- System.out.println("Fish type is selected ");
- return type=5.00;
- }
- else if(result>3){
- System.out.println();
- System.out.println("Invalid type! ");
- option2();
- }
- return type;
- }
- public static void option3(){
- Scanner input = new Scanner(System.in);
- double result;
- System.out.println("1-Cola");
- System.out.println("2-Milo");
- System.out.println("3-Pepsi");
- System.out.println("4-No drink");
- System.out.println();
- System.out.println("Choose your drinks: ");
- result = input.nextDouble();
- if(result==1){
- System.out.println();
- System.out.println("Cola drink is selected ");
- }
- else if(result==2){
- System.out.println();
- System.out.println("Milo drink is selected ");
- }
- else if(result==3){
- System.out.println();
- System.out.println("Pepsi drink is selected ");
- }
- else if(result==4){
- System.out.println();
- System.out.println("No drink ordered ");
- }
- else if(result>4){
- System.out.println();
- System.out.println("Invalid type!");
- option3();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment