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

import java.util.*; public class Birthday1{ public static void main(String[] arg

ID: 3786135 • Letter: I

Question

import java.util.*;

public class Birthday1{

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
intro();
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-31)? ");
int day = input.nextInt();

int numberOfDay = calDayInYear(month, day);

System.out.println(month + "/" + day + " is day # "+ numberOfDay + " of 365.");
System.out.println();
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-31)? ");
int birthday = input.nextInt();


int numberOfBirthday = calDayInYear(birthmonth,birthday);
System.out.println(month+"/"+day+" is day # "+ numberOfBirthday + " of 365.");

//birthday today
if(numberOfDay == numberOfBirthday){
System.out.println("Happy birthday!");
//birthday tomorrow
}else if (numberOfBirthday - numberOfDay == 1){
System.out.println("Wow, your birthday is tomorrow!");
//birthday ahead
}else if(numberOfDay < numberOfBirthday){
System.out.println("Your next birthday is in " + (numberOfBirthday - numberOfDay) +" days.");
//birthday behind
}else{
System.out.println("Your next birthday is in "+(365 + numberOfBirthday - numberOfDay)+" days.");
}
}
private static int calDayInYear(int month, int day) {
int DayOfMonth [] = {31,28,31,30,31,30,31,31,30,31,30,31};
int calDay = 0;

for(int i=0; i < month-1; i++){
calDay = calDay + month;
}
return calDay+day;
}


public static void intro(){
System.out.println("This program tells you how many days");
System.out.println("it will be until your next birthday");
System.out.println();
}

}

*****Turn the private static int into an if else cumulative sum giving the same return as the previous method

Explanation / Answer

I didn't understood wha'ts your actual question.I hope that you are asking to modify the code.Here,is the small mistake which I found out and rectified it.The modified data is the BOLD font

Hope my answer helped you.Any further doubts,please feel free to ask us.We will love to help you

Modified function: