Need help with homework problem in C# programming Drivers are concerned with the
ID: 3654620 • Letter: N
Question
Need help with homework problem in C# programming Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankful of gasoline by recording miles driven and gallon used for each tankful. Develop a C++ program that uses a while statement to input the miles driven and gallons used for each tankful.The program should calculate and display the miles per gallon obtained for each tankful and print the combined miles per gallon obtained for all tankfuls up to this point. All averaging calculations should produce floating-point results. Display the results rounded to the nearest hundredth. Use the console class's ReadLine method and sentinel-controlled repetition to obtain data from the user.Explanation / Answer
#pragma argsused #pragma hdrstop #include #include #include using namespace std; int main(int argc, char* argv[]) { // declare the variables double gallons; // read in the gallons double miles; // read in the miles double totalGallons; // calculate the total gallon input double totalMiles; // calculate the total mile input double total; // calculate the gallons/miles double average; // calculate the average overall double counter; // initialization phase total = 0; // initialise total counter = 1; // initialise loop counter coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.