Answer to Question #4324 in C++ for nadelta
2011-10-04T10:12:04-04:00
Thembi is concerned about her mileage on her new car.so she keeps a record of kilometres driven for the month of Novembe.The program below calculates her mileage for the month of November and the day on which her mileage was the maximum.Complete the lines of code where $ indicated.
float mileage;
float highestMileage;
float totalMileage;
int i=1;
int day=1;
cout <<"Enter mileage for November"<<i<<":";
cin>>mileage;
totalMileage=mileage;
highestMileage=mileage;
for(...;...;...)$
{
cout <<"Enter mileage for November"<<i<<":";
cin>>mileage;
if(...>highestMileage)$
{
day=...$
highestMileage=mileage;
}
totalMileage=...$
}
cout<<"Total Mileage for November:"<<totalMileage<<endl;
cout<<"Highest Mileage was"<<highestMileage<<"on"<<day<<"of November"<<endl;
return 0;
}
1
2012-03-30T09:24:41-0400
float mileage; float highestMileage; float totalMileage; int i=1; int day=1; & cout <<"Enter mileage for November"<<i<<":"; cin="">>mileage; & totalMileage=mileage; highestMileage=mileage; for(...;...;...)$ { cout <<"Enter mileage for November"<<i<<":"; cin="">>mileage; if(...>highestMileage)$ { & day=...$ & highestMileage=mileage; } totalMileage=...$ } cout<<"Total Mileage for November:"<<totalmileage<<endl; cout<<"highest="" mileage="" was"<<highestmileage<<"on"<<day<<"of="" november"<<endl;="" return="" 0;="" }<="" span=""></totalmileage<<endl;></i<<":";></i<<":";> float mileage; float highestMileage; float totalMileage; int i=1; int day=1; void main(){ & cout <<"Enter mileage for November "<<i<<":"; cin >>mileage; & totalMileage=mileage; highestMileage=mileage; for(i=2;i<=5;i++){ & cout <<"Enter mileage for November "<<i<<":"; & cin>>mileage; if(mileage>highestMileage){ & day=i; & highestMileage=mileage; } totalMileage += mileage; } cout<<"Total Mileage for November:"<<totalMileage<<endl; cout<<"highest mileage was "<<highestMileage<<" on "<<day<<" of november."<<endl; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment