Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FirstAssignment {
- public static void main(String[] args) {
- final int currentYear = 2019; //setting current year
- Scanner s = new Scanner(System.in); //creating a scanner
- System.out.println("Please enter your year of birth:");
- int yearOfBirth = s.nextInt(); //getting year of birth
- int userAge = currentYear - yearOfBirth; //calculating user age
- System.out.println("Please enter your ID number:");
- long idNum = s.nextLong(); //get id number
- System.out.println("Please enter your Height:");
- float userHeight = s.nextFloat(); //get user height
- // System.out.println("What is your gender M/F:"); // NOT IN USE IN THIS VERSION
- // char gender = s.next().charAt(0); //get user gender // NOT IN USE IN THIS VERSION
- System.out.println("What is your gender? Enter TRUE for male, FALSE for female:");
- boolean isMale = s.nextBoolean();
- //Display the information
- System.out.println("---------------------------");
- System.out.println("Your are " + userAge + " years young.");
- System.out.println("Your id number is: " + idNum);
- System.out.println("Your height is: " + userHeight);
- // System.out.println("Your are a: " + gender); // NOT IN USE IN THIS VERSION
- //checking is user is male or female
- if (isMale == true) {
- System.out.println("Your are a Male");
- } else {
- System.out.println("Your are a Female. How u doing?!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement