Write a class named Time It must have three private integer members named hours, mins and secs It must have a public constructor that sets the default time, hours, mins and secs to zero It must have two public member functions that are return type void. They must be settime with three integer arguments – this will allow the main function to reset the hours, mins and secs. show data with no arguments – this will allow the main function to display the time to the console. Use the main program as shown below to test your output against the output shown below: int main() {   Time a, b, c (8,20,10);  // declare 3 objects     b.settime(1,8,3);  // assign values to b's data members   a.showdata();      // display object a's values   b.showdata();      // display object b's values   c.showdata();      // display object c's values               return 0; }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 5E
icon
Related questions
Question

C++

  1. Write a class named Time
    1. It must have three private integer members named hours, mins and secs
    2. It must have a public constructor that sets the default time, hours, mins and secs to zero
    3. It must have two public member functions that are return type void. They must be
      1. settime with three integer arguments – this will allow the main function to reset the hours, mins and secs.
      2. show data with no arguments – this will allow the main function to display the time to the console.
    4. Use the main program as shown below to test your output against the output shown below:


      int main()

{

  Time a, b, c (8,20,10);  // declare 3 objects

 

  b.settime(1,8,3);  // assign values to b's data members

  a.showdata();      // display object a's values

  b.showdata();      // display object b's values

  c.showdata();      // display object c's values

              return 0;

}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr