SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 20 Nov 2017 My Price 8.00

read two integers with the following significance.

I need help finishing this c++ program. I'm having trouble getting the correct times to add up together.

 

endtime.cpp

program needs to read two integers with the following significance. The first integer value represents

a time of day on a 24 hour clock, so that 1245 represents quarter to one mid-day, for example. The second integer

represents a time duration in a similar way, so that 345 represents three hours and 45 minutes. This duration is to be

added to the first time, and the result printed out in the same notation, in this case 1630 which is the time 3 hours and

45 minutes after 12.45.

 

Enter in a start time: 1415

Enter in a duration: 50

End time is: 1505

 

#include <iostream>

 

using namespace std;

int main()

{

 int startTime;

 int durationTime;

 int endTime;

  

 cout << "Enter in a start time: ";

 cin >> startTime;

  

 cout << "Enter in a duration: ";

 cin >> durationTime;

  

 int startHours, startMinutes, durationHours, durationMinutes;

  

 startHours = startTime / 100;

 startMinutes = startTime % 100;

  

 durationHours = durationTime / 100;

 durationMinutes = durationTime % 100;

  

 int endMinutes = startMinutes + durationMinutes;

 int endTimeMin = endMinutes % 60;

 int endTimeHour = endMinutes / 100;

 int endHours = startHours + durationHours;

 int THours = endHours % 24;

  

 endTime = THours + endTimeHour + endTimeMin;

  

  

  if(endTime >= 2400)

    {

    endTime = endTime - 2400;

    }

    

 cout << "End time is: " << endTime << endl; 

  

}//main

Answers

(5)
Status NEW Posted 20 Nov 2017 12:11 PM My Price 8.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)