In: Computer Science
This code has to be in java (I code in eclipse). Also these instructions have to be followed exactly because if not my output won't match the expected out ( this will be uploaded on zybooks).
Write a program that asks the user for their age in days. The program will compute the person's age in years (you can assume that all years have 365 days) and then prints one of the following messages:
For example:
If the user entered: 350, your program would output: You are an infant
If the user entered: 800, your program would output: You are a toddler
If the user entered, 1825, your program would output: You are a child
If the user entered, 5475, your program would output: You are a teenager
If the user entered, 7300, your program would output: You are a young adult
If the user entered, 10950, your program would output: You are an adult
If the user entered, 23725, your program would output: You are middle aged
If the user entered, 25550, your program would output: You are a senior citizen
Your prompt to the user to enter the number of days must be:
Enter an age in number of days:
Please note that your class should be named AgeLabel.

import java.util.Scanner;
public class AgeLabel {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter an age in number of days: ");
int days = sc.nextInt();
double year = days/360.0;
if(year <= 1)
System.out.print("You are an infant");
else if(year <= 3)
System.out.print("You are a toddler");
else if(year <= 12)
System.out.print("You are a child");
else if(year <= 19)
System.out.print("You are a teenager");
else if(year <= 21)
System.out.print("You are a young adult");
else if(year <= 50)
System.out.print("You are an adult");
else if(year <= 65)
System.out.print("You are middle aged");
}
}
// Hit the thumbs up if you are fine with the answer. Happy Learning!