Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. static Scanner userInput = new Scanner(System.in);
  5. public static void main(String[] args){
  6. System.out.println("Type your name");
  7. if(userInput.hasNextLine()){
  8. String stringEntered = userInput.nextLine();
  9. System.out.println("Your name is: " + stringEntered);
  10. System.out.println("Hi " + stringEntered + ", how old are you?");
  11. int ageEntered = userInput.nextInt();
  12. if(ageEntered < 18){
  13. System.out.println("Sorry, " + stringEntered + ", You are unable to vote, or buy alcohol and cigarettes");
  14. }else if(ageEntered >= 18 && ageEntered <= 20){
  15. System.out.println("You are able to buy cigarettes, and vote.");
  16. }else{
  17. System.out.println("You are able to buy cigarettes, alcohol, and vote.");
  18. if(ageEntered >= 21) {
  19. System.out.println("Do you wanna to see something cool?");
  20. String answer = userInput.nextLine();
  21. if(answer.equalsIgnoreCase("yes")) {
  22.  
  23. }else if(answer.equalsIgnoreCase("no")){
  24. System.out.println("Well, thanks anyways. Goodbye.");
  25. }
  26. }
  27. }
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement