Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++. Using the Following code, finish it adding a: Convert Into Seconds: the total 3 times runner Runner .cpp: #include runner.h #include Runner::Runner() {

In C++. Using the Following code, finish it adding a: Convert Into Seconds: the total 3 times runner

Runner .cpp:

#include "runner.h"

#include

Runner::Runner()

{

name = "";

hh = 0;

mm = 0;

ss = 0;

}

Runner::Runner(Runner& r)

{

name = r.name;

hh = r.hh;

mm = r.mm;

ss = r.ss;

}

// mutator

void Runner::set_name(string n)

{

name = n;

}

void Runner::set_time(int h, int m, int s)

{

hh = h;

mm = m;

ss = s;

}

// accessor

string Runner::get_name() {

return name;

}

// print

void Runner::print(string pos) {

cout

}

// operator

bool operator

int t1, t2;

t1 = R1.ss + (60 * R1.mm) + (60 * 60 * R1.hh);

t2 = R2.ss + (60 * R2.mm) + (60 * 60 * R2.hh);

return t1

}

--------------------------------------------------------

runner.h

#ifndef RUNNER_H_

#define RUNNER_H_

#include

using namespace std;

class Runner {

private:

string name;

// time HH:MM:SS

int hh, mm, ss;

public:

// Constructor

Runner();

Runner(Runner& r);

// mutator

void set_name(string name);

void set_time(int h, int m, int s);

// accessor

string get_name();

// print

void print(string pos);

// operator

friend bool operator

};

#endif

---------------------------------------------------------------------

main.cpp

#include

#include "runner.h"

using namespace std;

void get_runner_details(Runner& R) {

string name;

int h, m, s;

cout

cin >> name;

R.set_name(name);

h = m = s = -1;

cout

cin >> h;

while (h

cout

cout

cin >> h;

}

cout

cin >> m;

while (m

cout

cout

cin >> m;

}

cout

cin >> s;

while (s

cout

cout

cin >> s;

}

R.set_time(h, m, s);

cout

}

void print_results(Runner R1, Runner R2, Runner R3) {

if (R1

R1.print("first");

if (R2

R2.print("second");

R3.print("third");

}

else {

R3.print("second");

R2.print("third");

}

}

else if (R2

R2.print("first");

if (R1

R1.print("second");

R3.print("third");

}

else {

R3.print("second");

R1.print("third");

}

}

else if (R3

R3.print("first");

if (R1

R1.print("second");

R2.print("third");

}

else {

R2.print("second");

R1.print("third");

}

}

}

int main() {

Runner R1, R2, R3;

cout

get_runner_details(R1);

cout

cout

get_runner_details(R2);

cout

cout

get_runner_details(R3);

cout

print_results(R1, R2, R3);

return 0;

}

----------------------------------------------------------------------------------

i need the time HH,MM,SS been converter in Seconds and appear in the output.

image text in transcribed
Please enter the #1 runner information: Please enter the name of the runner: Mark Enter hour: 2 Enter minutes: 36 Enter seconds: 25 Listo! ! Convert in to seconds : Please enter the #2 runner information: Please enter the name of the runner: James Enter hour : 2 Enter minutes : 45 Enter seconds : 25 Listo! ! Convert in to seconds: Please enter the #3 runner information: Please enter the name of the runner: Jessy Enter hour : 4 Enter minutes: 50 Enter seconds: 45 Listo! ! Convert in to seconds: Mark came at first place with time 2:36:25. James came at second place with time 2:45:25. Jessy came at third place with time 4:50:45. C:\\Users\\malen\\source\ epos\\Runner\\Debug\\Runner . exe (process 17704) exited with code 0. Press any key to close this window

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions