object oriented programming

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.

  1. 👍
  2. 👎
  3. 👁
  1. 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.

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. Art

    based on their attire, playing music during leisure time is most likely a pursuit of which greek class citizen? lower class musical class upper class middle class i believe it is upper class

  2. Math>> Help!!

    After knee surgery, your trainer tells you to return to yuor jogging program slowly. He suggests jogging for 12 minutes each day for the first week. Each week thereafter, he suggests that you increase that time by 6 minutes per

  3. English

    Five sentence paragraph. Preparing for a test should start the first day in class this includes paying attention in class,taking good notes,review all assignments on a regular basis. Budget your time make sure you set aside time

  4. 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

  1. Computer science

    need help how do this program. Use the top-down modular approach and pseudocode to design a suitable program to solve it. Alberta Einstein teaches a business class at Podunk University. To evaluate the students in this class, she

  2. Government

    In recent years public discussion has focused on the existence of federal budget deficits. Several key factors have led to increased budget deficits, and a number of proposals have been offered to address the problem. (a) Define

  3. Programming

    Write pseudocode to represent the logic of a program that allows the user to enter a value for hours worked in a day. The program calculates the hours worked in a five day week and the hours worked in a 252 day work year. The

  4. Computers(Java Programming)

    Service Class: Lottery Write a Lottery class that simulates a lottery. The class should define an array of five integers named lotteryNumbers. The constructor should use the Random class (see the Java API) to generate a random

  1. english composition 2

    A simple standard definition is normally composed of all of the following exept. a. characteristic of some class b.the term to be define c. A class containing the term to be define d. the distintive characteristic of the term I

  2. English

    Which letter would you choose for the section in parentheses? Grandpa could punch in the (time, and the channel) of his favorite daily news program, and the TV would turn on that program at the proper time.

  3. c++ programming

    Write a program that determines the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1, 2011 is day 1. December 31, 2010 is a day 365. December 31, 2012 is day 366, since 2012 is a

  4. Algebra and Maths

    In a pest eradication program, "N" sterilized male flies are released into a general population each day. It is estimated that 90% of these flies will survive a give data. A) Show that the number of sterilzed flies in population

You can view more similar questions or ask a new question.