IN C++
Programming Problem 1:
Write a program that calculates a truck's gas mileage and cost for a road trip. Be creative with the output, think of it as a “report”, give it a title at the top and use formatting where appropriate.
The program should set the number of gallons of gas that the truck can hold to 31, and the number of miles it can be driving on a full tank to 651. The program should display the number of gallons the truck can hold, the number of miles it can be driven on a full tank and then display the number of miles that may be driven per gallon of gas.
Next the program should display that the road trip that will be taking place is from Athens, AL to New Orleans, LA. The mileage for the trip is 436.4 miles one way. Gas prices are currently at $2.58 per gallon. You always want to fill up your gas tank when you reach half, 325 miles until empty, which means you have 15.5 gallons of gas left in the truck. Display the total mileage for the round trip, and how much you will spend on gas if you always fill up the tank when you reach its midpoint during the drive there, fill up the tank before leaving LA, and fill up when you reach its midpoint during the drive back to Athens.
Hint: You need to be careful as to how you solve this problem. I suggest solving it by hand first and then writing the code. When you reach New Orleans, you may not be exactly at half a tank (or the 325 miles driven) therefore you need to calculate how much it will cost you to fill up to come back to Athens based on how much gas is still left in the truck once you get there. There is an assumption that once the truck is parked in New Orleans, LA it is not driven again until it is time to drive back to Athens.
Your total expense for gas on this trip should come out to $93.54. Be sure to format your answers correctly with decimals when needed. There may be a few cents difference between our answers depending on how numbers are rounded.
BOOLEAN IS NOT ALLOWED
Code:

Code as text:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int tank_capacity = 31;
int full_tank_miles = 651;
int miles_per_gallon = full_tank_miles /
tank_capacity;
float trip_mileage = 436.4;
float gas_price = 2.58;
float total_gas_money = 0;
float gas_money, fuel_required;
cout << "-----Road Trip Report-----" <<
endl;
cout << "Number of gallons truck can hold: "
<< tank_capacity << " gallons" << endl;
cout << "Number of miles on full tank: "
<< full_tank_miles << " miles" << endl;
cout << "Number of miles per gallon: " <<
miles_per_gallon << " miles per gallon" << endl;
cout << endl;
cout << "Starting road trip from Athens, AL to
New Orleans, LA" << endl;
cout << "Trip mileage: " << trip_mileage
<< endl;
cout << endl;
cout << "326 miles done, 325 miles until empty.
Refueling 15.5 gallons of gas" << endl;
fuel_required = tank_capacity - 15.5;
gas_money = fuel_required * gas_price;
total_gas_money += gas_money;
cout << "Starting again.." << endl;
cout << "Reached New Orleans, LA." <<
endl;
cout << endl;
cout << "Return trip from New Orleans, LA to
Athens, AL" << endl;
cout << "Filling up tank before leaving LA."
<< endl;
fuel_required = (trip_mileage - 326) /
miles_per_gallon;
gas_money = fuel_required * gas_price;
total_gas_money += gas_money;
cout << "326 miles done, 325 miles until
empty. Refueling 15.5 gallons of gas" << endl;
fuel_required = tank_capacity - 15.5;
gas_money = fuel_required * gas_price;
total_gas_money += gas_money;
cout << "Starting again.." << endl;
cout << "Reached Athens, AL." <<
endl;
cout << endl;
cout << "-----Trip Summary-----" <<
endl;
cout << "Total mileage: " << trip_mileage
* 2 << " miles" << endl;
cout << "Total gas money: $" << fixed
<< setprecision(2) << total_gas_money <<
endl;
return 0;
}
Sample run:

P.s. Ask any doubts in comments and dont forget to rate the answer.
IN C++ Programming Problem 1: Write a program that calculates a truck's gas mileage and cost...
I need trying to figure out how I can make create a code in
Python with this exercise for I am having trouble doing so.
Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...
create an application in VISUAL BASIC that calculates a cars gas
mileage. The formula for calculating the miles that a car can
travel per gallon of gas is MPG = Miles/Gallon
In the formula MPG is miles-per-gallon, miles is the number of
miles that can be driven on a full tank of gas, and gallons is the
number of gallons that the tank holds.
The applications form should have TextBox controls that let the
user enter the number of gallons...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a C++ program that will input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful. After processing all input information, the program should calculate and print the combined miles per gallon obtained for all tankfuls....
Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# app that will input the miles driven and gallons used (both as integers) for each tankful. The app should calculate and display the miles per gallon obtained for each tankful and display the combined miles per gallon obtained for all tankfuls up to this point. All averaging...
Hi,
Hi,
I need someone to write a program in Phython 3.6, and please I
will appreciate if the code is error free and indented correctly.
The output would be preferable.
thanks
Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...
The Python program will compute total mileage for all trips included : Trip: 1,2,3,4 Mileage: 200, 400, 800, 10 Gas: 10, 17, 39, 1 As well as the fuel efficiency in miles per gallon. Your program will open the file, read it line by line and add the miles driven and the gallons gas consumed then calculate the average fuel efficiency. It will then write Once the program has read all the lines, it will write the total miles driven,...
Programming Language is Java Lab 1: Programming Exercises Input/Process/Output 1) Run the Numbers. Write a program with two input values. The program should display the sum, difference, quotient, product, and average of the two numbers. 2) Jake’s Problem. Jake has a car with an 8-gallon fuel tank. Jake fills his tank with gas and drives 60 miles to a friend’s house. When he gets to his friend’s house, he has 6 gallons left in his fuel tank. Write a program...
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 gallons used for each tankful. Develop a C++ program that inputs 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.
Write a Python program that does the following: Obtains the following input from a user: Mileage at beginning of measurement period Mileage at end of measurement period Gallons of fuel consumed Calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Incorporate some Selection structure logic into it: If a vehicle gets less than 15 miles per gallon, display the message: "Your vehicle has criminally low fuel efficiency." If it gets 15...
Use a java program that does the following:
. (10 points) Write a program as follows a. Prompt the user to input two positive integers: nl and n2 (nl should be less than n2) b. If the user enters the negative number(s), convert it/them to positive number(s) c. If nl is greater than n2, swap them. d. Use a while loop to output all the even numbers between nl and n2 e. Use a while loop to output the sum...