Question
Implement the addSeconds method in the EnhancedTime class in the P2 folder using the instructions below. You are NOT allowed to create any other methods,
Implement the addSeconds method in the EnhancedTime class in the P2 folder using the instructions below. You are NOT allowed to create any other methods, instance variables, or make any changes to methods other than addSeconds or files other than "EnhancedTime.java". You will lose points if you do. The addSeconds method adds a certain number of seconds to the time represented by the current Time object. The changes should be left on the current object. First, create an object of the EnhancedTime class in the test driver with an initial time and then call the addSeconds method on this object. For example, say you create a new object using the EnhancedTime class, named currentTime, and this new object contains the time 11:59:59 AM. You would then call the addSeconds(1) method on the currentTime object, making the time be 12:00:00 PM because 1 second has been added to the original time. If the current time is 08:17:36 PM and 18,000 seconds (5 hours) are added, the new time would be 01:17:36 AM. Note that adding a large number of seconds can move the time across days, and you need to update AM and PM for the time properly. Do NOT use any off-the-shelf implementations (e.g. Javas built-in time library and its methods) for the above method. You are required to do it from scratch using basic date structures!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started