SHARE
TWEET

Untitled

markov5534 Nov 19th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package bg.unwe;
  7.  
  8.  
  9. import java.util.Scanner;
  10.  
  11.  
  12. public class Birthday {
  13.  
  14.    
  15.     public static void main(String[] args) {
  16.      
  17.         Scanner scanner=new Scanner(System.in);
  18.         System.out.println("Your birthday is: ");
  19.         System.out.print("Year: ");
  20.         int year=Integer.parseInt(scanner.nextLine());
  21.         System.out.print("Month: ");
  22.         int month=Integer.parseInt(scanner.nextLine());
  23.         System.out.print("Day: ");
  24.         int day=Integer.parseInt(scanner.nextLine());
  25.         if (month<1&&month>12) {
  26.             System.out.println("Wrong month!");
  27.         }else if(day<1&&day>31)
  28.             System.out.println("Wrong day!");
  29.         {
  30.            
  31.         }
  32.         System.out.println("Today is: ");
  33.        
  34.         System.out.print("Year: ");
  35.         int yeart=Integer.parseInt(scanner.nextLine());
  36.         System.out.print("Month: ");
  37.         int montht=Integer.parseInt(scanner.nextLine());
  38.         System.out.print("Day: ");
  39.         int dayt=Integer.parseInt(scanner.nextLine());
  40.        
  41.         if (montht<1&&month>12) {
  42.             System.out.println("Wrong month!");
  43.         }else if(dayt<1&&day>31)
  44.             System.out.println("Wrong day!");
  45.         {
  46.         }
  47.             int age;
  48.            
  49.             if (month>=montht) {
  50.                 age=(yeart-year)-1;
  51.                 System.out.printf("You are %d years old.\n", age);
  52.                 if (age<0) {
  53.                     System.out.println("You haven't been born yet");
  54.                 }else if(age>0&&age<=3){
  55.                     System.out.println("You are a baby");
  56.                 }else if(age>3&&age<=13){
  57.                     System.out.println("You are a child");
  58.                     }else if(age>13&&age<=19){
  59.                     System.out.println("You are a teenager");
  60.                     }else if(age>19&&age>60){
  61.                     System.out.println("You are a an old person");
  62.                     }else if(age>60&&age>90){
  63.                     System.out.println("You are a vey old person");
  64.                     }else if(age>90&&age>130){
  65.                     System.out.println("Are you sure you've entered correct information?");
  66.             }else if(month<montht){
  67.                 age=yeart-year;
  68.                 System.out.printf("You are %d years old.\n", age);
  69.         if (age<0) {
  70.                     System.out.println("You haven't been born yet");
  71.                 }else if(age>0&&age<=3){
  72.                     System.out.println("You are a baby");
  73.                 }else if(age>3&&age<=13){
  74.                     System.out.println("You are a child");
  75.                     }else if(age>13&&age<=19){
  76.                     System.out.println("You are a teenager");
  77.                     }else if(age>19&&age>60){
  78.                     System.out.println("You are a an old person");
  79.                     }else if(age>60&&age>90){
  80.                     System.out.println("You are a vey old person");
  81.                     }else if(age>90&&age>130){
  82.                    
  83.             }
  84.            
  85.                
  86.             }
  87.         {
  88.            
  89.         }
  90.        
  91.        
  92.        
  93.     }
  94.    
  95.         }
  96.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top