Question

WAP to read age of a Person and display remarks accordingly. Age Remarks Age < 12...

WAP to read age of a Person and display remarks accordingly. Age Remarks Age < 12 Child 12 >= age < 20 Teen 20 >= age < 30 Adult 30 >= age < 55 Young Age >= 55 Old in java

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class AgeRemarks {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter your age: ");
        int age = in.nextInt();
        // Age < 12 Child
        // 12 >= age < 20 Teen
        // 20 >= age < 30 Adult
        // 30 >= age < 55 Young
        // Age >= 55 Old
        if (age < 12) {
            System.out.println("Child");
        } else if (age < 20) {
            System.out.println("Teen");
        } else if (age < 30) {
            System.out.println("Adult");
        } else if (age < 55) {
            System.out.println("Young");
        } else {
            System.out.println("Old");
        }
    }
}

Enter your age: 25 Adult Process finished with exit code 0

Add a comment
Know the answer?
Add Answer to:
WAP to read age of a Person and display remarks accordingly. Age Remarks Age < 12...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python help. Write a program that asks the user to enter a person's age. The program...

    Python help. Write a program that asks the user to enter a person's age. The program should display a message indicating whether the person is an infant, a child, a teenager, or an adult. Following are the guidelines: If the person is 2 year old or less, he or she is an infant. If the person is older than 2 year, but younger than 13 years, he or she is a child. If the person is at least 13 years...

  • Case Program 10 – 1: Part 1: Previously, you created a Contestant class for the Greenville Idol c...

    Case Program 10 – 1: Part 1: Previously, you created a Contestant class for the Greenville Idol competition. The class includes a contestant’s name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field Fee that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three...

  • /************************************************************************* * Compilation: javac JavaLab1.java * Execution: java JavaLab1 * Authors: Odile wolf, Olusola Samuel-Ojo *...

    /************************************************************************* * Compilation: javac JavaLab1.java * Execution: java JavaLab1 * Authors: Odile wolf, Olusola Samuel-Ojo * Date created: Jan 15th 2014 * Last update date: Sep 13th 2017 * You will modify the code to ask the user for their age and the age of their child, and output how old the mother * was when the child was born * % java JavaLab1 * What is your name ? Jane * Jane, what is your age? 30 * What...

  • Explain 20 please 100 Age 591 Questions 17 - 21 are based on the graph to...

    Explain 20 please 100 Age 591 Questions 17 - 21 are based on the graph to the right. This graph describes the age structure of a population 96-991 17. The fraction of the youngest age class is 90-941 a. The largest in the population 85-891 80-841 b. The smallest in the population 75-79 C. Larger than that of middle age classes (30 - 60 70-74 85-89 years old) 60-64 d. Smaller than that of middle age classes (30 - 60...

  • please help answer questions 1-13. age *condes Crosstabulation condes Not Condescending Condescending Total age Young Count...

    please help answer questions 1-13. age *condes Crosstabulation condes Not Condescending Condescending Total age Young Count 21 9 30 Expected Count 20.7 9.3 30.0 % within age 70.0% 30.0% 100.0% Middle-Aged Count 25 5 30 Expected Count 20.7 9.3 30.0 % within age 83.3% 16.7% 100.0% Elderly Count 16 14 30 Expected Count 20.7 9.3 30.0 % within age 53.3% 46.7% 100.0% Total Count 62 28 90 Expected Count 62.0 28.0 90.0 % within age 68.9% 31.1% 100.0% Chi-Square Tests...

  • Question: I do no understand this week's JAVA programming project, which is a program that mimics...

    Question: I do no understand this week's JAVA programming project, which is a program that mimics ticket purchases for train objects. It is a train class that includes: 5 static constants. The five values can be seen in the Method descriptions below. There were no static constants provided, but my best guess is: kidTicketCost (cost of kids ticket is $7.50) adultTicketCost (adult ticket cost is $14.50) ageOfKid (age of the kid) ageOfAdult,(age of the adult) trainSeatStatus. (checks to see if...

  • This is an "extra credit assignment, more difficult than most. Since get a point in the...

    This is an "extra credit assignment, more difficult than most. Since get a point in the course. irs an extra credit challenge, 'il give only minimal help. This assignment is one of the hardest ways to Improve your Retirement the company). program based on these rules. Eligibility for retirement is based on age (how oid the worker is and service (how long the worker has worked at 1. 30 and out: anyone with 30 years of service can retire, no...

  • a. Use t and F to test for a significant relationship between HRS1 and age. Use...

    a. Use t and F to test for a significant relationship between HRS1 and age. Use α = 0.05 and make sure you know what hypotheses you are using to conduct the significance tests.[3.5 points] b. Calculate and interpret the coefficient of determination R2. Based on this R2, did the estimated regression equation provide a good fit? Briefly justify your answer. Hint: If you used Excel Regression Tool to answer part c, R2was reported with your output.  [2.5 points] Use the...

  • :2. A study was conducted in which participants looked at photographs of various people and guessed how old each photographed person was. Then the amount of error in each guess was calculated, and th...

    :2. A study was conducted in which participants looked at photographs of various people and guessed how old each photographed person was. Then the amount of error in each guess was calculated, and this was used as a response variable in regression analyses. Here are the names of the variables used; these will be referenced in the questions below: Error: Difference between guessed age and true age. (Positive errors are overestimates, i.e. guessing an age greater than true age; negative...

  • Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket...

    Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket costs $ 39, each child (>= 3 years old, <= 12 years old) ticket costs $26.50 and each young child (< 3 years old) ticket is free. Write a program to ask the user to enter the number of tickets for each type and then display the ticket information. Your code must work exactly like the following example (the text in bold indicates the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT