This is in visual basic 60 Write a program that analyzes the

This is in visual basic 6.0

Write a program that analyzes the data produced by the program described in programming project 3. The program should calculate and display the total miles driven by all the trucks, the total # of gallons of fuel used and the average miles per gallon for the entire fleet. You should use the Open dialog box provided by the common dialog control

The data would be for example the total of the miles, gallons driven, and MPG written in the previous file as

truck # (not included in this program), miles, gallons

This is a link to the previous question:

https://www.chegg.com/homework-help/questions-and-answers/visual-basic-60-design-program-used-store-data-produced-trucking-fleet-program-used-enter--q15505837

Thanks!

4. Write a program that analyzes the data produced by the program describel in programming project 3. The program should calculate and display ihe. total miles driven by all the trucks, the total number of gallons of fuel thar was used, and the average miles per gallon (rounded to one place beyondthe decimal point) for the entire fleet. You should use the Open dialog bou which is provided by the common dialog control. Trucking Fleet Analyzer Fleet Open Miles 175432 Gallons 40798 -Analyze MPG 4.3 Egit

Solution

#include <iostream>

#include <fstream>

#include <iomanip>

#include <cstdlib>

#include <climits>

using namespace std;

int main() {

                   ifstream In(\"TravelData.txt\");

                  ofstream Out(\"CostData.txt\");

                  Out << fixed << showpoint;

                 double Miles,

                  Gallons,

                 GasCostPerGallon;

                  double MilesPerGallon,

                  GasCostPerMile;

                  double GasCost;

                  double TotalMiles,

                  TotalGallons,

                 TotalCost;

                double OverallMPG,

                OverallCostPerMile;

                int numTrips;

               TotalMiles = 0.0;

              TotalCost = 0.0;

               TotalGallons = 0.0;

               numTrips = 0;

          MilesPerGallon = 0.0;

          GasCostPerMile = 0.0;

               if (In.fail()) {

                                   cout << \"Input file not found: \" << \"TravelData.txt\" << endl;

                                    cout << \"Exiting...\" << endl;

                                    return EXIT_SUCCESS;

                                    }

        Out << \"Programmer: \" << endl;

       Out << \"CS 1044 Project 2 Fall 2003\" << endl;

       Out << endl;

      Out << \"Trip Miles Gallons MPG $PM\" << endl;

       Out << \"--------------------------------------\" << endl;

     In.ignore(INT_MAX, \'\ \');

     In.ignore(INT_MAX, \'\ \');

     In.ignore(INT_MAX, \'\ \');

     In.ignore(INT_MAX, \'\ \');

      In >> Miles >> Gallons >> GasCostPerGallon;

         while (In) {

               Out << setw( 4) << numTrips

                       << setw( 7) << setprecision(1) << Miles

                      << setw(10) << setprecision(1) << Gallons

                       << setw( 8) << setprecision(2) << MilesPerGallon

                       << setw( 9) << setprecision(3) << GasCostPerMile << endl;

                       In >> Miles >> Gallons >> GasCostPerGallon;

                 }

            if (TotalGallons > 0) {

                                    }

          else {

                  OverallMPG = 0.0;

                    }

        if (TotalMiles > 0) { }

          else {

                   OverallCostPerMile = 0.0;

                 }

          Out << \"--------------------------------------\" << endl;

          Out << setw(11) << setprecision(1) << TotalMiles

                 << setw(10) << setprecision(1) << TotalGallons

                  << setw( 8) << setprecision(2) << OverallMPG

                   << setw( 9) << setprecision(3) << OverallCostPerMile << endl;

          In.close();

         Out.close();

         return(EXIT_SUCCESS);

     }

This is in visual basic 6.0 Write a program that analyzes the data produced by the program described in programming project 3. The program should calculate and
This is in visual basic 6.0 Write a program that analyzes the data produced by the program described in programming project 3. The program should calculate and
This is in visual basic 6.0 Write a program that analyzes the data produced by the program described in programming project 3. The program should calculate and

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site