Question: #include CalculateDelayHeader.h int main() { std::string filename=numbers.txt; std::ifstream inFile; int delay=0; //open the file bool ok = openFile(filename, inFile); //if open successfully if (ok){ //while

 #include "CalculateDelayHeader.h" int main() { std::string filename="numbers.txt"; std::ifstream inFile; int delay=0;

#include "CalculateDelayHeader.h"

int main() { std::string filename="numbers.txt"; std::ifstream inFile; int delay=0; //open the file bool ok = openFile(filename, inFile); //if open successfully if (ok){ //while there are data sets while (ok){ //calculate delay delay =processFile(inFile); // display the calculated delay displayDelay(delay); //check if more data ok=checkFile(inFile);

}

} }

#include "CalculateDelayHeader.h" //check if file is available

bool openFile( std::string filename, std::ifstream &inFile){ inFile.open(filename); if (inFile.fail()) return false; else return true;

} //display the delay void displayDelay(int delay){ std::cout

//divide tempDelay by 100 // add line here // if tempDelay equals 12, set it to 0 // add line here // multiply tempActual by 60 and add actual%100 // add line here //calculate difference between tempDelay and tempActual // add line here return diff;

} //read the data sets from the file int processFile(std::ifstream &inFile){ int actual, delay; inFile>>actual>>delay; std::cout

#include #include #include #include using std::string; bool openFile(std::string filename, std::ifstream &inFile); int processFile(std::ifstream &inFile); bool checkFile(std::ifstream &inFile); void displayDelay(int delay);

Numbers.txt =

1145 1159 1140 1140 0455 0500 0344 0405 1230 0245

Problem You need to write a program that reads two integers from a file called "numbers.txt. Each number represents time in hhmm format. For example the numbers may look like 1145 or 0301. These integers represent arrival/departure times of a flight. There are four sets of numbers in the file. Your task is to calculate the time difference in minutes between these two integers. You may assume that the second number represents a later time ("actual arrival/departure time of a flight) and the first number represents an earlier time("scheduled arrival/departure time of a flight") You can use the code in this lab to complete the accompanying programming assignment. You are given The lab template consisting of the file calculateDelayFunctions.cpp, calculateDelayHeader.h, calculateDelayMain.cpp What to do Use the given lab template. Populate the function calculateDelay(int actual, int scheduled) with the code where indicated. Include documentation for the program with header and line comments

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!