Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code should be written in simple java Problem: The purpose of this assignment is to gain experience solving exception handling in your Java code. Write

code should be written in simple java image text in transcribed
image text in transcribed
Problem: The purpose of this assignment is to gain experience solving exception handling in your Java code. Write a program that reads a string from the keyboard and tests whether it contains a valid date Display the date as described below if it is valid, otherwise input date should have the format mm/dd/vyy, where mm and dd can be one or two digits display a message as described below. The Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from the user(give an example of the fornat you are expecting the user to use when entering the date) and check for the following: a. missing one of parts (that is the month or the day or the year is missing. Check this by checking the number of slashes ()), eg mm/dd is invalid b. mm or dd or yyyy is not numeric c. month not between 1 and 12 d. day is not in the right range (this depends on the month) e. year isn't 2000 or higher If the user gives you invalid input, start the whole process again by asking the user for a valid date, Keep prompting the user until you get a valid date. A while Evalid) loop would work well here. If the date is valid, then output a message with a copy of the input date values indicating it isa valid date" Bonus Mark: One of the checks should be for leap years. February has 28 days except for leap years when it has 29. A leap year (for the 2000s) is any ycar divisible by 4

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

Which of the following is NOT a relational operator? 1. =

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago