Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //for Avery. Here's the code you wrote; that I RE-wrote in like a minute. You pig.
- import java.util.Scanner;
- public class drinkingage{
- private static Scanner sc = new Scanner(System.in);
- public static void
- main(String... args){
- scan();
- }
- public static void
- scan(){
- System.out.println("How old are you?");
- String age = sc.nextLine();
- decide(Integer.parseInt(age));
- }
- public static void
- decide(int age){
- if(age>=21)
- System.out.println("You can drink! Cheers!");
- else
- System.out.println("Sorry, you cannot drink. " + (21 - age) + " more years!");
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement