Question

In: Computer Science

IN C++ LANGUAGE PLEASE:::: Is there a Prius version? Did you know that the average Boeing...

IN C++ LANGUAGE PLEASE::::

Is there a Prius version? Did you know that the average Boeing 747 airplane uses approximately 1 gallon of fuel per second?  Given the speed of the airplane, that means it gets 5 gallons to the mile. No, not 5 miles to the gallon, 5 gallons to the mile.   You may be questioning why such a horribly inefficient machine is allowed to exist, but you’ll be happy to find out that, because this airplane hold 568 people, it averages about 0.01 gallons per person – (100 miles per gallon per person).

Your job is to design (pseudocode) and implement (source code) a program that asks the user for a distance the plane has to fly (i.e. the length of the trip) and also asks the cost of jet fuel (which is currently $1.80 per gallon).  The program should then calculate the total fuel charges to make the trip.  Next, ask the user how many people will fly, as well as the average cost of a ticket.  Finally, print the total profit made (or lost) and the average gas mileage per person.

Solutions

Expert Solution

pseudocode

const gallonsPerMile=5

tripDistance=Input length of trip in miles
costOfFuel= enter cost of jet fuel per gallon
numberOfpesseger=enter total number of pessenger travel
costPerTicket=enter cost of pessenger ticket

calclate Total Gallons of fuel neede totalGallons=tripDistance*gallonsPerMile;\

calculate total cost of the fuel totalFuelCost=totalGallons*costOfFuel;

calculate total price of the all ticket totalTicketPrice=numberOfpesseger*costPerTicket;

check totalFuelCost is less then totalTicketPrice then profit made and it is totalTicketPrice-totalFuelCost

or if totalFuelCost is greater then totalTicketPrice then loss made and it is totalFuelCost- totalTicketPrice

The average gas mileage per person =totalGallons/numberOfpesseger

code

#include<iostream>

using namespace std;
const int gallonsPerMile=5;
int main()
{
   double tripDistance,costOfFuel,costPerTicket,totalTicketPrice;
   double totalGallons,totalProfitLoss,totalFuelCost;
   int numberOfpesseger;

   cout<<"Enter the length of the trip in miles: ";
   cin>>tripDistance;

   cout<<"Enter the cost of jet fuel per gallon: ";
   cin>>costOfFuel;

   cout<<"Number of pessenger will fly: ";
   cin>>numberOfpesseger;

   cout<<"Enter the average cost of ticket: ";
   cin>>costPerTicket;

   totalGallons=tripDistance*gallonsPerMile;

   totalFuelCost=totalGallons*costOfFuel;

   totalTicketPrice=numberOfpesseger*costPerTicket;

   if(totalTicketPrice>totalFuelCost)
   {
       totalProfitLoss=totalTicketPrice-totalFuelCost;
       cout<<"Total profit made: $"<<totalProfitLoss<<endl;
   }
   else if(totalTicketPrice<totalFuelCost)
   {
       totalProfitLoss=totalFuelCost;-totalTicketPrice;
       cout<<"Total loss : $"<<totalProfitLoss<<endl;
   }
   else
   {
       cout<<"No profit no loss made;"<<endl;
   }
   cout<<"\nThe average gas mileage per person "<<totalGallons/numberOfpesseger<<endl;
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

PLEASE DO THIS IN C#.Is there a Prius version? Did you know that the average Boeing...
PLEASE DO THIS IN C#.Is there a Prius version? Did you know that the average Boeing 747 airplane uses approximately 1 gallon of fuel per second? Given the speed of the airplane, that means it gets 5 gallons to the mile. No, not 5 miles to the gallon, 5 gallons to the mile. You may be questioning why such a horribly inefficient machine is allowed to exist, but you’ll be happy to find out that, because this airplane hold 568...
IN C++ LANGUAGE PLEASE::: I’m buyin’ a Ferrari!  If you’ve ever travelled to another country, you know...
IN C++ LANGUAGE PLEASE::: I’m buyin’ a Ferrari!  If you’ve ever travelled to another country, you know that working with different currencies takes a while to get used to.  As of the date of making this assignment, there are 9,240.00 Guinean Francs to $1 USD.  For this program, design (pseudocode) and implement (source code) aprogram that prompts the user for the amount of U.S. currency they have, and converts it into Ginean Francs.
Language C++ Most people know that the average human body temperature is 98.6 Fahrenheit (F). However,...
Language C++ Most people know that the average human body temperature is 98.6 Fahrenheit (F). However, body temperatures can reach extreme levels, at which point the person will likely become unconscious (or worse). Those extremes are at or below 86 F and at or above 106 F. Write a program that asks the user for a body temperature in Fahrenheit (decimals are ok). Check if that temperature is in the danger zone (for unconsciousness) or not and produce the relevant...
(C++) Write version 1.0 of the Rider class for the elevator simulation. Riders will "know" their...
(C++) Write version 1.0 of the Rider class for the elevator simulation. Riders will "know" their starting floor and their destination floor. But instead of using pointers or reference variables as data members, they use whole number int s. (The simulation will have an array of floor objects to which all classes will have access, so all that's needed to refer to a floor is its index in the global array.) Here's its specification: As the only data members, two...
on C++ language please and if you can also put note on it to better undertand...
on C++ language please and if you can also put note on it to better undertand it. Write a program that reads data from a data file, the value of which is provided at the end of the problem. Your program is to incorporate the following requirements: Data to the program is input from a file of an unspecified length; that is, the program does not know in advance how many numbers are in the file. Save the output of...
Did you know that there are over 500 types of bananas in the world? Did you...
Did you know that there are over 500 types of bananas in the world? Did you also know that bananas are an excellent source of potassium, fiber, and vitamin B-6 as well as serve as a powerful antioxidant? However, most people might not be aware of the prolific amount of banana consuming possibilities that are available to them. Wouldn't it be amazing if we have a program that would randomly recommend a type of banana for someone to eat every...
Please use C language to code all of the problems below. Please submit a .c file...
Please use C language to code all of the problems below. Please submit a .c file for each of the solutions, that includes the required functions, tests you wrote to check your code and a main function to run the code. Q2. Implement the quick-sort algorithm.
Please do in java Program 3: Give a baby $5,000! Did you know that, over the...
Please do in java Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement...
Answer in C++ language please** I got stuck. How do I find the Overall Average,Overall Highest...
Answer in C++ language please** I got stuck. How do I find the Overall Average,Overall Highest number, and the Overall Lowest Number after all of this?? #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; const int ALIASFILE_LINE_COUNT =16; const float USERBONUSLEVEL = 75.09; const float USERAWARDLEVEL = 80.72; const int USERBONUS = 5; const int USERAWARD = 8; void selectionSortAsc( double list[], int length); int main() {cout <<"\n\nproject 3 template,.. \n ,...includes global constants for project.\n"<<endl; //1....
IMPORTANT: I know the answer is "C". However, I don't know why. Could you please explain...
IMPORTANT: I know the answer is "C". However, I don't know why. Could you please explain why? Thank you A linear total cost curve that passes through the origin implies that a.         average cost is constant and marginal cost is variable. b.         average cost is variable and marginal cost is constant.             c.         average and marginal costs are constant and equal.             d.         you need more information to answer question.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT