#include using std::cout; #include using std::setfill; using std::setw; #include "timel.h" Time:: Time () { } void { hour minute second = 0; } Time::setTime( } void Time: :printUniversal () { ? h = 0; hour= (h >= 0 && h < 24 ) minute = ( m >= 0 && m < 60 ) ? m: 0; second = (s >= 0 && S < 60 ) ? S: 0; int h, int m, cout< using std::cout; #include "timel.h" int main() { int s ) return 0; , Explain why the following program returns errors. Time t; // create Time object (b) ( t.hour 7; // error: 'Time: :hour' is not accessible. // error: 'Time: :minute' is not accessible. cout <

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

Please answer fast

 

#include <iostream>
using std::cout;
#include <iomanip>
using std::setfill;
using std::setw;
#include "timel.h"
Time:: Time ()
{
}
void Time::setTime (int h, int m,
{
}
hour minute second = 0;
}
void Time: :printUniversal ()
{
int s )
hour= (h>= 0 && h < 24 ) ? h: 0;
minute = ( m >= 0 && m < 60 ) ? m: 0;
second = = (S>= 0 && S
>= 0 && S < 60 )
< 60 ) ? s: 0;
}
cout << setfill( '0') <<setw( 2 ) << hour << ":"
<<setw( 2 ) << minute << ":" <<setw( 2 ) << second;
(a)
#include <iostream>
using std::cout;
#include "timel.h"
int main()
{
Time t; // create Time object
t.hour 7; // error: 'Time: :hour' is not accessible.
// error: 'Time: :minute' is not accessible
cout <<t.hour << ":" << t.minute << ":" << t.second;
return 0;
Explain why the following program returns errors.
(b) (
Correct the program so it can work properly.
Transcribed Image Text:#include <iostream> using std::cout; #include <iomanip> using std::setfill; using std::setw; #include "timel.h" Time:: Time () { } void Time::setTime (int h, int m, { } hour minute second = 0; } void Time: :printUniversal () { int s ) hour= (h>= 0 && h < 24 ) ? h: 0; minute = ( m >= 0 && m < 60 ) ? m: 0; second = = (S>= 0 && S >= 0 && S < 60 ) < 60 ) ? s: 0; } cout << setfill( '0') <<setw( 2 ) << hour << ":" <<setw( 2 ) << minute << ":" <<setw( 2 ) << second; (a) #include <iostream> using std::cout; #include "timel.h" int main() { Time t; // create Time object t.hour 7; // error: 'Time: :hour' is not accessible. // error: 'Time: :minute' is not accessible cout <<t.hour << ":" << t.minute << ":" << t.second; return 0; Explain why the following program returns errors. (b) ( Correct the program so it can work properly.
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Types of Loop
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,