Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need a proper line to line unique code for both the questions with output not the one copied from github or chatgpt Review Lab

image text in transcribed
image text in transcribedi need a proper line to line unique code for both the questions with output not the one copied from github or chatgpt
Review Lab - Class and Object Question I Design a class named Timer that contains the following thrte private instance data fields: hosrs; an integer that holds the number of hours. mimates: an integer that holds the number of minutes. seconds: an integer that holds the number of seconds. In addition, the class should have the following constructors and methods; 1. A no-arg constructor that creates a default Tiser object (The data fields hours, minates, seconds are defaulted to 0). 2. A constructor that constructs a Tumer object with three specified values for hours, minutes, and seconds. 3. Three pablic setter methods for the data fields hours, mintes and seconds. 4. Three public getter methods for the data fields howrs, mistates and seconds. In the second constructor and three setter methods above, make sure that the three data fields are greater than or equal to 0. e.g, if the value used to set the data field hours is negative, you should then set hours to 0 instead. Write a test program to do the following tasks: 1. Prompt the user to enter three groups of values of hours, minintes and seconds and use these values to create an array of three Timer objects. 2. Calculate and print the total number of hours, meimutes, and seconds in these three objects. 3. Three public setter methods for the data ficids hours, minunes and seconds. 4. Three publie getter methods for the data fields hears, minutes and second's. In the second constructor and three setter methods above, make sare that the three data fields are greater than or equal to 0. e.gn7 if the value used to set the data field howes is negative, you should then set hours to 0 instead. Write a test program to do the following tasks: 1. Prompt the user to enter three groups of values of houers, minules and seconds and use these values to create an array of three Timer objects. 2. Calculate and print the total number of howurs, minutes, and secounds in these three objects. Qucstion II Siogneucha Devign a class named 5 topwa teh. The class contains: - Prisate data fields startfines and enet iaw with petier mesteak. A no-ary condrastio that iaitialses seartT ine with the cadent time. A method ramesl a top () that sets the end 1 ne so the curnest time. A method named jetElapsedt ine (h that nyturns the clapsed tine for the Dar tec UMi. degrait for the \&las then implimed the ilas. Write a tes frogram

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

More Books

Students also viewed these Databases questions

Question

What are the keys to effective self-leadership?

Answered: 1 week ago

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago