Overview

For this assignment, each student will write a program that will calculate an end date given a starting date and number of days.

Prerequisites

Details

Most programming languages possess libraries for working with and manipulating times and dates. These libraries are essential because many real-world applications require tracking and representing the passage of time. However, representing and manipulating date and year information can be difficult because months have different numbers of days and there are leap years.

In this Lab, you must write a program called DateAdder.java, that asks the user for a start date in the form mm/dd/yyyy and a number from 0 to 100 inclusive to add. You must then print out the resulting date by adding the days entered. For example, if the user enters 12/15/2023 and 77, the end date would be March 1, 2024, which would be printed out as 03/01/2024. You must print out this end date in the form mm/dd/yyyy. See the sample output below.

You are not allowed to use any built-in Java libraries that deal with dates or times. You are also not allowed to use loops or arrays. You can assume the user enters a valid date and int for the days.

Enter a start date in the form mm/dd/yyyy
11/15/2025
Enter the number of days, which must be less than or equal to 100, to advance
47
47 day(s) after 11/15/2025 is 01/01/2026.

SampleRuns

Just for fun

The following is not required, but can be added to your program once you are done if you are looking for an additional challenge or practice.

Acknowledgement

This laboratory assignment was developed by Dr. Roby Velez.

See your professor's instructions for details on submission guidelines and due dates.