The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hi, I need answer ASAP!
Given the following class declaration:
public class TimeRecord
{ private int hours; private int minutes; // 0 ≤ minutes < 60 // ADD CODE }
Add into class TimeRecord:
1. (3 pts) A public constructor with 2 int parameters h and m. This constructor will assign h to instance data member hours and assign m to instance data member minutes.
2. (2 pts) A public getHours method to return the number of hours.
3. (2 pts) A public getMinutes method to return the number of minutes.
4. (4 pts) A public advance method to add h hours and m minutes to this TimeRecord object. For example, if a TimeRecord object tr is currently 1Â hours and 20 minutes, tr.advance(2, 50) will change it to 4Â hours and 10 minutes.
public void advance(int h, int m)
For 1-4, indent your code properly. Comment your code if needed. No need to add prologue comments.
-----------