Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS210 (B,C) Final Review # 4 is ie Classes and Objects A Cl1o /I an ho // the d Suppose that you are provided with

image text in transcribed
CS210 (B,C) Final Review # 4 is ie Classes and Objects A Cl1o /I an ho // the d Suppose that you are provided with a pre-written class ClockTime as described at right. (The headings are shown, but not the method bodies. to save space.) Assume that the fields, constructor, and methods shown are already implemented. You may refer to them or use them in solving this problem if necessary. // 10:4 pri pr Write an instance method named advance that will be placed inside the ClockTime class to become a part of each ClockTime object's behavior. The advance method accepts a number of minutes as its parameter and moves the ClockTime object forward in time by that number of minutes. The minutes passed could be any non-negative number, even a large number such as 500 or 1000000. If necessary, your object might wrap into the next hour or day, or it might wrap from the morning ("AM") to the evening ("PM") or vice versa. A ClockTime object doesn't care pu eabout what day it is; if you advance by 1 minute from 11:59 PM, it becomes 12:00 AM. For example, if the following object is declared in client code: ClockTime time new ClockTime (6, 27, "PM") The following calls to your method would modify the object's state as indicated in the comments. time.advance (1); time.advance (30) time.advance (5) time.advance (60) time.advance (128) time.advance (180) time.advance (1440) // 1:11 AM (1 day later) time.advance (21075) I 4:26 PM (2 weeks later) 6:28 PM 6:58 PM // 7:03 PM // 8:03 PM // 10:11 PM Assume that the state of the ClockTime object is valid at the start of the call and that the amPm field stores either "AM" or "PM

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

1. What macroeconomic issues have been in the news lately?

Answered: 1 week ago