Suppose we need to implement a more accurate timer than the one in the example above, it needs to store the time in milliseconds (a millisecond is 1/1,000 seconds) instead of seconds. Here is a new version of the class Timer, all of the changes are highlighted in grey. Timer Fields num timeInMilliseconds boolean isRunning Methods timeInMilliseconds = isRunning = startTimer() isRunning = incrementOneMillisecond() isRunning then timeInMilliseconds = timeInMilliseconds + endif num getTimeInSeconds() timeInMilliSeconds/Do the following:1. Using the original version of Timer, write a main program (main is the code that goes between start and stop) that declares an object of class Timer (if you forgot how, review Week 9 Topic 3: Create objects). Then perform the following steps using the timer object you have created.Reset the timer.Output a message for the user to “press any key”.Input the key press from the user and then immediately start the timer.Output a message for the user to “press any key”.Input the key press from the user and then immediately output the timer’s current time in seconds. 2. Describe any changes to your code that would be required to use the new more accurate implementation of Timer. 3. Using Timer as an example, describe two advantages of encapsulation. How would the two versions of the code have been different if we had used a procedural programming approach (only methods, no classes or objects) instead of an Object-Oriented Programming approach?
“I’m trying to write my paper and I’m stuck. Can you help me?”
Yes, we can help you achieve academic success without the uncessary stress of deadlines.
Our reliable essay writing service is a great opportunity for you to save your time and receive the best paper ever.
Original version of Timer
Plagiarism-free and delivered on time!
We are passionate about delivering quality essays.
Our writers know how to write on any topic and subject area while meeting all of your specific requirements.
Unlike most other services, we will do a free revision if you need us to make corrections even after delivery.