Answer to Question #37434 in C++ for Nessma
number between 1 and 1000. (A prime number is a number that is only divisible by itself).! !
2- Assume that there is a driver of a taxi and he asked you to develop a program for him as the followings:!
• He will enter the information for each trip during his day.!
NOTE: trip's data will be:!
- The income of the trip.!
- The distance of the trip.!
NOTE: the driver will stop the program when he gets a total income in his day that is greater!
than > 300 L.E.!
• Display how many trips he made in his day.!
• Display the total distance he made during his day.!
• Determine which trip was the shortest trip.
using namespace std;
int main ()
int TripsCounter = 0;
float TotalIncome = 0;
float TotalDistance = 0;
float TheShortestTrip = 1000000 ;
cout<<"Hello dear driver"<<endl;
cout<<"Please, enter the income of the trip ($): ";
cout<<"Please, enter the distance of the trip (km): ";
TotalIncome += income;
TotalDistance += distance;
if (distance < TheShortestTrip)
TheShortestTrip = distance;
cout<<"So today you have made "<<TripsCounter<<" trips"<<endl;
cout<<"Total distace is: "<<TotalDistance<<" km"<<endl;
cout<<"The shortest trip is "<<TheShortestTrip<<" km"<<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!