This assignment is scored out of 64. It consists of 7 questions. The first 6 questions are to be completed on D2L as an online quiz.

computer science

Description

This assignment is scored out of 64. It consists of 7 questions. The first 6 questions are to be completed on D2L as an online quiz. There is a programming question and you will need to put all your Java programs (*.java) as well as output files for this question in the folder named LastName_FirstName_CS304_HW1. Zip this folder, and submit it as one file to Desire2Learn. Do not hand in any printouts. Triple check your assignment before you submit. If you submit multiple times, only your latest version will be graded and its timestamp will be used to determine whether a late penalty should be applied.


Short Answers 

Complete Quiz 1 on D2L by the due date. You might see there is a time limit of 120 minutes on this quiz but it is not enforced so you can ignore it. Before you complete all questions, DO NOT submit! Doing so will prevent any further changes to the answers. You can save your answers for as many times as you want before submission.


Programming 

Questions (40pts) You are provided with a Date class and an incomplete EnhancedDate class. The EnhancedDate class inherits from the Date class with two more methods: addDays(int numDays) – This method adds a certain number of days to the date represented by the current Date object. The changes should be left on the current object. This task is done by first creating an object of the EnhancedDate class in the test driver with an initial date and then calling the addDays method on this object. For example, if the current EnhancedDate object, say currentDate, contains the date 1/1/2016, then after the addDays(20) method is called on currentDate, the date in it would be 1/21/2016 because 20 days has been added to the original date. This is not a simple addition because you need to take care of different months as well as leap years. daysFrom(Date startDate) – This method computes the number of days elapsed from startDate, and returns an integer. If the startDate is earlier than the current day, the return should be positive, whereas if it is later than the current date, then this method should return a negative number. Hint: you can call the compareTo method provided in the Date class to check which of the two dates is older so that you can always count the days from the older date to the newer date. You may choose to use the above addDays method to simplify this implementation – you can keep adding a day to the older date until you bring it up to the newer date.

Instruction Files
prog.zip
2.9 KB
HW1.pdf
229.9 KB

Related Questions in computer science category