Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello Everyone, I need help for this program Use this information to print the u

ID: 3634762 • Letter: H

Question

Hello Everyone,
I need help for this program
Use this information to print the user's birthday in year/month/day format, the day of the week the user was born, and how old the user is in days. If the user was born in a leap year, you print an additional message letting them know their birth year was a leap year.

Below are several example logs of execution from the program; user input is in bold. Output is in italics. Your program's output should match these examples exactly given the same input.

What is today's date (month day year)? 8 8 2010

What is your birthday (month day year)? 1 26 1971

You were born on 1971/1/26, which was a Tuesday.

You are 14439 days old.

What is today's date (month day year)? 8 8 2010

What is your birthday (month day year)? 2 2 1996

You were born on 1996/2/2, which was a Friday. 1996 was a leap year.

You are 5301 days old.

What is today's date (month day year)? 8 8 2010

What is your birthday (month day year)? 11 8 1900

You were born on 1900/11/8, which was a Thursday.

You are 40085 days old.

What is today's date (month day year)? 7 11 1856

What is your birthday (month day year)? 10 2 1800

You were born on 1800/10/2, which was a Thursday.

You are 20371 days old.

Explanation / Answer

please rate - thanks import java.util.*; public class DateClient {public static void main(String[] args) { int m,d,y; Scanner in=new Scanner(System.in); System.out.print("What is today's date (month day year)? "); m=in.nextInt(); d=in.nextInt(); y=in.nextInt(); Date today=new Date(m,d,y); System.out.print("What is your birthday (month day year)? "); m=in.nextInt(); d=in.nextInt(); y=in.nextInt(); Date bday=new Date(m,d,y); System.out.println("You were born on "+bday.toString()+", which was a "+bday.getDayofWeek()+"."); if(bday.leap(bday.getYear())==1) System.out.println( bday.getYear()+" was a leap year."); System.out.println("You are "+bday.daysAlive(today) +" days old."); } } ---------------------------------------------- public class Date {private int dMonth; //variable to store the month private int dDay; //variable to store the day private int dYear; //variable to store the year public Date() { } public Date(int m, int d, int y) {dMonth=m; dDay=d; dYear=y; } public int getMonth() {return dMonth; } public int getDay() {return dDay; } public int getYear() {return dYear; } public void setYear(int y) {dYear=y; } public String toString() {return (dYear + "/" + dMonth + "/" + dDay); } public int daysAlive(Date a) {int doy,doy2,days,j; doy=todoy(dMonth,dDay,dYear); //get day of year for 1st date doy2=todoy(a.dMonth,a.dDay,a.dYear); // get day of year for second date days=0; if(a.dYear-dYear==0) // same year? days=doy2-doy; else if(a.dYear-dYear==1) days=365+leap(dYear)-doy+doy2+days; // if 1 year apart get difference else {for(j=dYear+1;j1 year apart add 365 or 366 for each year days=days+365+leap(j); days=365+leap(dYear)-doy+doy2+days; } return days; } public int todoy(int month,int day,int year) {int daysinmonth; int days=0,i; for (i=1;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote