Question

I need help and have to have this done by tomorrow midnight thanks in advance You...

I need help and have to have this done by tomorrow midnight thanks in advance

You have been requested by car manufacturer to develop a program that satisfies the following requirements:

a. Be able to handle 4 different car models

b. Enter the Model Name of each of the cars

c. Enter the miles per gallons (MPG) for each of the cars

d.Enter the size of the gas tank in gallons for each of the cars

e. Calculate the Endurance Value for each of the cars

Formula 1: Endurance Value = Gallons * MPG

f. Determine how many car models have an endurance of at least 200 miles but less than

300 miles.

Please turn in the source code.

Test Case:

Model Name

Gallons

MPG

Endurance

Ford

12 20 240

Chevy

10

18

180

Toyota

16

30

480

Lexus

11

25

275

2 cars satisfied the endurance criteria:

1.) Ford at 240 miles

2.) Lexus at 275 miles

Grading Scheme

Compile\Link

5

Input

6

Endurance Calc

7

Endurance Criteria

7

Display

5

========

30

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
using namespace std;
int main()
{
   string cars[4];
   double miles[4];
   double size[4];
   double endurance[4];
   int i,count=0;
   //loop to input the car details
   for(i=0;i<4;i++)
   {
      cout<<endl<<"ENter the model of car";
      fflush(stdin);
      getline(cin,cars[i]); //read the car model name
     
      cout<<endl<<"ENter the Miles for gallons of "<<cars[i];
          fflush(stdin);
       cin>>miles[i]; //input the miles per gallon
      
       cout<<endl<<"ENter the Size of gas tank for "<<cars[i];
           fflush(stdin);
       cin>>size[i];//input the size of gas tank
      
       endurance[i] = miles[i] * size[i];//compute the endurance
      
   }
   //display the details
   cout<<endl<<"MODEL MPG SIZE OF GAS TANK ENDURANCE";
   for(i=0;i<4;i++)
   {
      cout<<endl<<cars[i]<<"\t\t"<<miles[i]<<"\t\t"<<size[i]<<"\t\t"<<endurance[i];
      if(endurance[i]>=200 && endurance[i]<=300) //count the number of cars satisfy the endurance criteria
      count++;
      
   }
   cout<<endl<<count<< " cars satisfied the endurance criteria";
   //loop to display the cars which satisfy the endurance criteria
   for(i=0;i<4;i++)
   {
      if(endurance[i]>=200 && endurance[i]<=300)
       cout<<endl<<cars[i]<<" at "<<endurance[i]<<" miles";
      
   }
     
  
}

OUTPUT

Add a comment
Know the answer?
Add Answer to:
I need help and have to have this done by tomorrow midnight thanks in advance You...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need this in java Using the mileage data file provided. The file contains a log of...

    need this in java Using the mileage data file provided. The file contains a log of miles and the gas used at each fill up. The fields are the model, miles and gallons of gas used. Use the data to create a set of parallel arrays to produce inquires and reports. Your program will produce a miles per gallon report. The report will consist of the following elements. Model, Total Gallons, Total Miles and Miles Per Gallons. This is a...

  • As part of a study designed to compare hybrid and similarly equipped conventional vehicles, Consumer Reports...

    As part of a study designed to compare hybrid and similarly equipped conventional vehicles, Consumer Reports tested a variety of classes of hybrid and all-gas model cars and sport utility vehicles (SUVs). The following data show the miles-per-gallon rating Consumer Reports obtained for two hybrid small cars, two hybrid midsize cars, two hybrid small SUVs, and two hybrid midsize SUVs; also shown are the miles per gallon obtained for eight similarly equipped conventional models. Dataset: CarModels What are the treatment(s)...

  • Hey I am having trouble with this problem in C++: The first race is tomorrow! You...

    Hey I am having trouble with this problem in C++: The first race is tomorrow! You are provided a list of race entries in the following form: vector<string> entryList = { "42, Vance Cardoza", "55, Vanessa Pandara", "36, Gaston Carlton", "99, Rich Diesel", "10, Euler Bustamente" }; In your main() function instantiate a Race object. Use a C++ iterator to walk through the entries in the list above, parse out each car number and driver name and add them to...

  • Python 3 Problem: I hope you can help with this please answer the problem using python...

    Python 3 Problem: I hope you can help with this please answer the problem using python 3. Thanks! Code the program below . The program must contain and use a main function that is called inside of: If __name__ == “__main__”: Create the abstract base class Vehicle with the following attributes: Variables Methods Manufacturer Model Wheels TypeOfVehicle Seats printDetails() - ABC checkInfo(**kwargs) The methods with ABC next to them should be abstracted and overloaded in the child class Create three...

  • I need Help PLZ ( Java Code ). Tomorrow 05.06.2019 I have to hand in my homework. reachability Actually, you find f...

    I need Help PLZ ( Java Code ). Tomorrow 05.06.2019 I have to hand in my homework. reachability Actually, you find flying very good, but you do not trust the whole new-fangled flying stuff and the infrastructure it has built up. As a diehard medieval metal fan you prefer to travel from A to B but rather the good old catapult. Since one can not easily take the favorite cat on vacation with it (cats do not get drafts, which...

  • This is assignment and code from this site but it will not compile....can you help? home...

    This is assignment and code from this site but it will not compile....can you help? home / study / engineering / computer science / computer science questions and answers / c++ this assignment requires several classes which interact with each other. two class aggregations ... Question: C++ This assignment requires several classes which interact with each other. Two class aggregatio... (1 bookmark) C++ This assignment requires several classes which interact with each other. Two class aggregations are formed. The program...

  • I just need help with the highlighted section please give details File Teols View Homework -...

    I just need help with the highlighted section please give details File Teols View Homework - Chapter 14 To b e the cost of equity for TSLA, to finance yahoo.com and t he ticket wybol TSLA. Follow the links to the following questions What is the most a price and for TSLAY What is the market value of guy, of m et carbon How many shares of stock does TSLA utanding? What is the most recent and can you the...

  • Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void...

    Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void main(String[] args) { int currentVertex, userChoice; Scanner input = new Scanner(System.in); // create graph using your WeightedGraph based on author's Graph WeightedGraph myGraph = new WeightedGraph(4); // add labels myGraph.setLabel(0,"Spot zero"); myGraph.setLabel(1,"Spot one"); myGraph.setLabel(2,"Spot two"); myGraph.setLabel(3,"Spot three"); // Add each edge (this directed Graph has 5 edges, // so we add 5 edges) myGraph.addEdge(0,2,9); myGraph.addEdge(1,0,7); myGraph.addEdge(2,3,12); myGraph.addEdge(3,0,15); myGraph.addEdge(3,1,6); // let's pretend we are on...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT