Question: Write a java program which inputs two people's names and ages, and then outputs if one or both people are between 18 and 65 years

Write a java program which inputs two people's names and ages, and then outputs if one or both people are between 18 and 65 years old.

  • Your program must output the words "neither" and "both" when appropriate, as shown below.
  • Your program must have at least 2 functions (including main).
  • Here is some sample output:
  • Please enter first person's name: Craig Please enter Craig's age: 48 Please enter second person's name: Mark Please enter Mark's age: 52 Both people are between 18 and 65 
    Please enter first person's name: Tobias Please enter Tobias's age: 16 Please enter second person's name: Dylan Please enter Dylan's age: 16 Neither person is between 18 and 65. 
    Please enter first person's name: Serafina Please enter Serafina's age: 18 Please enter second person's name: Tobias Please enter Tobias's age: 16 Serafina is between 18 and 65, but Tobias is not. 
    Please enter first person's name: Bo Please enter Bo's age: 76 Please enter second person's name: Bob Please enter Bob's age: 74 Neither person is between 18 and 65.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!