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

The following are four runs of your program and their expected output (user inpu

ID: 3627291 • Letter: T

Question

The following are four runs of your program and their expected output (user
input is bold and underlined):
This program tells you how many days it will be until your next birthday.
Please enter today's date:
What is the month (1-12)? 7
What is the day (1-31)? 24
7/24 is day #205 of 365.
Please enter your birthday:
What is the month (1-12)? 11
What is the day (1-30)? 6
11/6 is day #310 of 365.
Your next birthday is in 105 days.
-------
This program tells you how many days it will be until your next birthday.
Please enter today's date:
What is the month (1-12)? 9
What is the day (1-30)? 22
9/22 is day #265 of 365.
Please enter your birthday:
What is the month (1-12)? 3
What is the day (1-31)? 17
3/17 is day #76 of 365.
Your next birthday is in 176 days.
--------
This program tells you how many days it will be until your next birthday.
Please enter today's date:
What is the month (1-12)? 2
What is the day (1-28)? 14
2/14 is day #45 of 365.
Please enter your birthday:
What is the month (1-12)? 2
What is the day (1-28)? 15
2/15 is day #46 of 365.
Wow, your birthday is tomorrow!
------
This program tells you how many days it will be until your next birthday.
Please enter today's date:
What is the month (1-12)? 12
What is the day (1-31)? 25
12/25 is day #359 of 365.
Please enter your birthday:
What is the month (1-12)? 12
What is the day (1-31)? 25
12/25 is day #359 of 365.
Happy birthday!
---------
Since this is an interactive program, it behaves differently when given different input.
The examples above do not show all possible cases.
You may assume that all user input is valid; that when prompted for a date, the user will
enter an integer in a valid range. You may also assume that your program is not run in a
leap year, so February always has 28 days.

Explanation / Answer

import java.util.Scanner; public class cramaster { /** * @param args */ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out .println("This program tells you how many days it will be until your next birthday.Please enter today's date:"); System.out.println("Please enter today's date: "); System.out.print("what is the month(1-12)?"); int month = input.nextInt(); System.out.print("What is the day (1-30)?"); int day = input.nextInt(); int numberOfDay = calDayInYear(month,day); System.out.println(month+"/"+day+" is day # "+numberOfDay +" of 365."); System.out.println("Please enter you birthday: "); System.out.print("what is the month(1-12)?"); int birthmonth = input.nextInt(); System.out.print("What is the day (1-30)?"); int birthday = input.nextInt(); int numberOfBirthday = calDayInYear(birthmonth,birthday); System.out.println(month+"/"+day+" is day # "+numberOfBirthday +" of 365."); if(numberOfDay
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