object oriented programming

posted by .

We want to define a class clockType, to implement the time of day in a program. The time is represented as a set of three integers: one to represent the hours, one to represent the minutes, and one to represent the seconds. We also want to perform the following operations on the time:
1. Set the time to secs = 0, mins = 0, and hrs = 0 implicitly when an object of type clockType is declared
2. Set the time to a specific value
3. Print the time
4. Increment the time by one second
5. Increment the time by one minute
6. Increment the time by one hour

1. Write the definition of the class clockType including the definition of the different methods.

2. Write a main program to test the various operations of the class clockType.

  • object oriented programming -

    So you'll need to define a class, with three instance variables, declared private and of type int.
    You will need a default constructor to set the time to 0/0/0.
    Get/set methods.
    toString() method if you're using Java, or an equivalent method to print the time.
    Three methods to increment the hour/minute/seconds respectively.

    Then you'll be ready to design the main program to test the class methods.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. let's try this again - precal

    Write a formula for converting hours, starting with midnight as zero, to a decimal number of degrees. Assume that a full day equals 360º, 60 minutes equals one hour, and 60 seconds equals one minute. Use x, y, and z to represent hours, …
  2. computer science

    to write a report on Object-Oriented Systems. The report should focus on the following systems including definition, applications, and advantages and disadvantages. • Object-oriented Systems • Object-oriented database • Object-oriented …
  3. Algebra 2

    Dawn is writing a computer program to find the salaries of her employees after their annual raise. The percentage of increase is represented by p in the program. Marty's salary is $23,450 now. Write a polynomial to represent Marty's …
  4. c++ programming

    Solve the following problem. Apply all the steps i.e decomposition, Flowcharting and Pseudo code. Also write C++ program. Design and Write an interactive program that computes the salary in Rupees of a part-time employee based on: …
  5. programming

    Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules. a.A call made between 8:00 AM and 6:00 PM is billed at a rate of 6 rupees per minute. b.A …
  6. math

    Define a new class Assistant that represent a faculty member who works a certain number of hours each month. In this case, the salary is computed by multiplying the working hours by the hourly payment rate.  Create a new object …
  7. Algebra 1

    1. A company is deciding whether or not to hire a new worker. The company must pay the worker hourly and cover a daily cost for insurance. The cost to pay an hourly worker for one day is represented by the function y = 8x + 25, where …
  8. Math Algebra 1

    1. A company is deciding whether or not to hire a new worker. The company must pay the worker hourly and cover a daily cost for insurance. The cost to pay an hourly worker for one day is represented by the function y = 8x + 25, where …
  9. programming

    Example Develop a pseudocode algorithm for a program that accepts each of the average marks of 10 students in a class and computes the sum and the average mark of the class. The program should display the average mark of the class. …
  10. Python Programming

    Given a time in the 12 hour format with the suffix, either AM/PM, convert that into a 24 hour format. 12 hour format is hours:minutes:seconds followed by AM or PM, where the hours range is from 0 to 12, minutes range is from 0 to 59, …

More Similar Questions