Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROBLEM 2) Exercise 2: Birth Date Application: (40 pts) Use MOD % and / division to separate digits in Birthday date (updated om 2/9)

JAVA PROBLEM

image text in transcribedimage text in transcribed

2) Exercise 2: Birth Date Application: (40 pts) Use MOD % and / division to separate digits in Birthday date (updated om 2/9) Ask for the user to enter two people's birthday as an 8 digit-number! The user should enter the birthday for each person in an 8-digit format ("YYYYMMDD"). Then your program should compare the two birthday dates to determine which person is older, or they have the same age. For example, President's Obama's birthday is Aug 4, 1961. So, it should be entered as 19610804 (YYYYMMDD). We can assume that the user enters good data with 8 digits for each birthday so you do not have to do any data validation. This program should separate each 8-digit number into three separate numbers to represent the day, month, and year, in that order. Use the mathematical operators to separate the digits (will cover this during class). Thus, in our example the program would assign 4 to a first variable, let's say day, then assign 8 to a second variable, let's say month and 1961 to the number variable, let's say year. Next the program should print out the date of birth written in the following standard format MM/DD/YYYY for each person (Do not worry about leading zeroes for days and months.) So, the output for Obama's date of birth should be as follow: 8/4/1961 Also, your program should be able to print which person is older or the other possibility that they are the same age. You should use control structure allowing program to make decision (smart). So, result should be decided by program and not you. Example (Comparing Obama's to Beyonc): Enter the birthday in 8-digit format for person's # 1: (YYYYMMDD): 08041961 Enter the birthday in 8-digit format for person's # 2, (YYYYMMDD): 09041981 For this example, the following result will be printed: Enter name for person #1: Obama Enter name for person #2: Beyonc Obama's date of birth is: 8/4/1961 Beyonc's date of birth is: 9/4/1981 Obama is Older than Beyonc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago

Question

=+development and make the product, should you go ahead and do so?

Answered: 1 week ago