Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview: In this project you will prompt the user for the month, day and year, and print out the previous day, with the month spelled

image text in transcribed
image text in transcribed
Overview: In this project you will prompt the user for the month, day and year, and print out the previous day, with the month spelled out. Example: Date (month day year): 3 13 2021 March 12, 2021 Instructions: 1. Create a new BlueJ project, Project1, with a class, Dater 2. In maino, prompt the user to enter the day, month and year with a space in between 1. The entries will be numeric, but not necessarily legal (e.g., month 13) 3. Check the year, month and day, in that order. 1. If the year is valid (between 0-2099 inclusive), perform step 3.2, otherwise print an error and exit the program. 2. If the year is valid, check the month. If the month is between 1-12, perform step 3.3, otherwise print an error and exit the program 3. If the month is valid, check the day. If valid decrement it by 1. This may cause ramifications. If so, adjust month and/or year, as appropriate. Then print the decremented day, with the month spelled out as shown below, otherwise print an error and exit the program. Requirements and Observations: 1. Just use if, if-else, if-else if, and switch statements. If we didn't talk about it in class, or it didn't show up in assigned ZyBooks readings, don't use it. System.exit(, return, arrays, etc., are all verboten. 2. Think about this problem before you code. Figure out the algorithm first, trying it with multiple dates. If you can't do this by hand, you can't cajole Java into solving it for you. 3. Structure the program to make it easy to understand, with nested ifs, switch statements where appropriate, and additional variables if needed. 4. Put comments besides the beginning an if statement to make it clear what that is doing, e.g., // leap year 5. The description in the instructions is outlining a set of if-else-if statements (otherwise == else) 6. Your instructor found that writing boolean variables -- isLeap Year, is 30Day Month, and is 31DayMonth -- helped keep the logic easier to understand. 7. The program will be tested with tricky edge cases, but we will not worry about Gregorian v. Julian calendars. Remember that a year is a leap year if it is divisible by 4 and not divisible by 100 (e.g. 2020) or if it is divisible by 400. In a leap year, February has 29 days; otherwise it has 28. 8. Prompts should look exactly like those shown in the sample output. 9. Your project must compile to get at least partial credit. Sample Output (user Input Is in bold): Date (month day year): 2 28 2021 February 27, 2021 Date (month day year): 21 2021 January 31, 2021 Date (month day year): 11 2021 December 31, 2020 Date (month day year): 131 2021 Invalid month Date (month day year): 12 32 2021 Use the 11 dates Invalid day shown here for your Date (month day year): 2 29 2020 February 28, 2026 screenshot Date (month day year): 2 20 2019 Invalid day Date (month day year): 11 2100 Invalid year Date (month day year): 110 December 31, -1 Date (month day year): 5 19 1900 May 18, 1900 Date (month day year): 7 7 1802 July 6, 1802 Deliverables: 1. The project, zipped 2. A screenshot", showing the output of your program. Use the values shown in the Sample output. The screenshot should be uploaded separately from your project, and not zipped -- just .jpg or.png 3. The README.TXT with these fields: 1. PROJECT TITLE: 2. PURPOSE OF PROJECT: 3. VERSION or DATE: 4. AUTHOR: 5. PROJECT STATUS: (a brief commentary on how you think the project stands, relative to the requirements, e.g., working perfectly, has trouble with February, doesn't even compile.) 6. PROJECT CHALLENGES: What was easy about this project? What was hard? What did you think about this project?] *Turn off Clear screen at method call so you can show more output on one screen. If your program crashes, or shows incorrect output, just move on to the next case. wa Options Clear XK month day year) Save to file... 35 Print XP Clear screen al method call Record method calls Unimited buffering Clo WW

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions