Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

solution Write a c++ program that has a Time class and an Ltime class. The Times

ID: 3645538 • Letter: S

Question

solution Write a c++ program that has a Time class and an Ltime class. The Times class should have integer data members named hours, minutes, and seconds, and the Ltime class hsould have a long integer data member named elsecs, which represents the number of elapsed seconds since midnight. For the Time class, include a conversion operator function named Ltime() that converts a Time object to an Ltime object. For the Ltime class, include a conversion operator function named Time() that convrts an Ltime object to a Time object.

I have this, but can't figure it out. In no means do you have to use any of this code. It doesn't work or give the information ask for in the problem. I only have until 2 to post the answer and have worked on it for hours.
#include <iostream>
#include <iomanip>

using namespace std;

class Ltime;
class Time
{
public:
int hh;
int mm;
int ss;
int hours, minutes, seconds;
Time (int hours, int minutes, int seconds );
/*operator Ltime();*/
void showtime(int hours, int minutes, int seconds);
void settime(int hours = 0, int minutes = 0, int seconds = 0);
class Ltime
{
public:
long elsec;
Ltime(long = 0);
void Time ();
void showagain(long elsec);
};
}
//void Time:: settime(int hours, int minutes, int seconds)
//{
// hours = hh;
// minutes = mm;
// seconds = ss;
//}
void Time::showtime()
{
cout << " The time is " << hours
<<':'<<minutes<<':'<<seconds;
}
long LTime:: elsec( long);
{
long elsec= (hours*3600)+(minutes*60)+seconds;
cout << elsec;

return ;
}

//Ltime::Ltime(long hms)
//{
// int hhmmss;
// hhmmss = hrs+min+sec;
// hhmmss=hms;
// return ;
//}
//void Ltime::showagain(elsec)
//{
// cout << elsec;
// return;
//}

int main()
{
{
Time a(),b();
Ltime c(),d();
b()=Time(a());
d()=Ltime(c());
cout << " standard time is ";
a().showtime();
cout << " as an Ltime object this date is ";
d(). showagain();
cout << " seconds elapsed time is ";
c().showagain();
cout << " as a Time object this ";
b().showtime();
cout << endl;

cin.ignore();
return 0;
}
}

Explanation / Answer

#include #include using std::cout; using std::setfill; using std::setw; using std::cin; using std::cout; using std::endl; class Time { public: Time( int = 0, int = 0, int = 0 ); // default constructor const Time Time::operator+(const Time &other) ; void setTime( int, int, int ); // set time void setHour( int ); // set hour void setMinute( int ); // set minute void setSecond( int ); // set second int getHour() const; // return hour int getMinute() const; // return minute int getSecond() const; // return second void Time::get( ); void Time::show(); private: int hour; // 0 - 23 (24-hour clock format) int minute; // 0 - 59 int second; // 0 – 59 }; Time::Time( int hour, int minute, int second ) { setTime( hour, minute, second ); } void Time::setTime( int hour, int minute, int second ) { setHour( hour ); setMinute( minute ); setSecond( second ); } void Time::get( ) { int hour, minute, second; cout > hour; cout