Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BCS 345: Java Programming CRN 94760 Fall 2017 Instructor: Dr. Jie Li Homework 5 -Wednesday, November 1 Due Wednesday, November 29, 11:59PM on Blackboard ve:

image text in transcribed
image text in transcribed
image text in transcribed
BCS 345: Java Programming CRN 94760 Fall 2017 Instructor: Dr. Jie Li Homework 5 -Wednesday, November 1 Due Wednesday, November 29, 11:59PM on Blackboard ve: Use class inheritance and class aggregation to create new classes. Catch and handle exceptions in the program. Write methods to process array of objects. Tasks This assignment deserves 200 points. Part 1 - Write a Date Class (30 points) The Date class should consist of three private fields: Instance Fields year month Description An int variable that holds the value of a year An int variable that holds the value of a month. An int variable that holds the value of a day. The Date class should also have the following public instance methods. Instance Methods constructor Creates a Date object and initializes year to 2001, month and day to l Overloaded constructor Creates a Date object and initializes the year, month, and day according to the arguments. Hint: call the setDate method to ensure data validation Create a Date object and initializes the year, month, and day using an existing Date object Returns the value in year Returns the value in month. Returns the value in day Sets the year, month and day according to the parameters. Data validation should be provided. I) A valid year should be between 1900 and 2017, inclusive, otherwise using 2001 for the year 2) A valid month should be between 1 and 12, inclusive, otherwise using 1 for the month. 3) A valid day should be between Copy Constructor getYear getMonth getDay setDate 1 and 31 when the month is 1, 3, 5, 7, 8, 10, or 12, (which means there are 31 days in January. March. May, July, August, October, and . 1 and 30 when the month is 4, 6, 9, or 11. 1 and 28 when the month is 2, i.e., simply assume there are 28 days in February Use 1 for the day if the value is invalid

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions