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

Reuse and reimplement portions of the Day of the Year progranm For this program,

ID: 3727596 • Letter: R

Question

Reuse and reimplement portions of the Day of the Year progranm For this program, you will be utilizing some of the work you have already done before for the Day of the Year program. There are twelve methods to write for this program (see the list later in the assignment), many of which will use pieces of code that youve already written for your previous assignment The main work you'll need to do while writing the various methods is to figure out what the method is asking you to implement and what code you may have already written that you can reuse in the method. In some cases, you may be able to mostly copy/paste your previous work into the appropriate method and be done. In other cases, you may be able to use what you ve already written as a foundation for implementing a particular method. The end goal of this program is to provide the user with a menu of choices that they will select from that will end up calling and thus utilizing the methods you've written for the assignment. Creating an API Much as the Math class allows you to use methods such as Math.powMath.sqrt and Math.sin) this program takes some beginning steps toward creating what is known as an Application Program Interface (API). From Wikipedia (https:len.wikipedia.org/wiki/Application programming interface): In computer programming, an application programming interface (APl) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components. A good API makes it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer

Explanation / Answer

Hello There,

Let us implement the requested method isDateValid by using the already implemented method daysInMonth as follows:

public static boolean isDateValid(int month, int day, int year){

boolean returnValue = true;

if(month <=0 || month > 12 || day <=0 || day > 31 || year <= 0){ // checks if any of day, month, year is negative and out of range

returnValue = false;

}else{

int noOfDaysInMonth = daysInMonth(month, year);

if(day > noOfDaysInMonth){ // checks if given day is more than the no of days in that month

returnValue = false;

}

}

return returnValue;

}

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