Advertisement
YouKnowWho07

Java food app project

Mar 7th, 2025
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. package practice;
  2. import java.util.Scanner;
  3.  
  4. public class project {
  5.  
  6.     public static void main(String[] args) {
  7.         System.out.println("Hello, Welcome to the food app");
  8.         System.out.println("Please create a password: ");
  9.         Scanner scan = new Scanner(System.in);
  10.         String pass1 = scan.next();
  11.         System.out.println("Your password is now: "+ pass1);
  12.        
  13.         System.out.println("Please enter your password: ");
  14.         String pass = scan.next();
  15.        
  16.         while(!pass.equals(pass1)) {
  17.             System.out.println("This is not the right password, please try again: ");
  18.             pass = scan.next();
  19.         }
  20.        
  21.         System.out.println("Access granted");
  22.         System.out.println("Are you hungry: Yes or No : ");
  23.         String ans1 = scan.next();
  24.        
  25.         if(ans1.equals("yes")) {
  26.             System.out.println("Choose what you want to eat between: pizza, burger or fish");
  27.             String ans2 = scan.next();
  28.            
  29.             while(!ans2.equals("pizza") && !ans2.equals("burger") && !ans2.equals("fish")) {
  30.                 System.out.println("Sorry we do not have it, what would you like between: pizza, burger or fish");
  31.                 ans2 = scan.next();
  32.             }
  33.             if (ans2.equals("pizza") || ans2.equals("burger") || ans2.equals("fish")) {
  34.                 System.out.println("Do you want something to drink? ");
  35.                 String ans3 = scan.next();
  36.             }      
  37.         }
  38.         else {
  39.             System.out.println("Alright, have a good day");
  40.         }  
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement