Solve this problem

write a c++ program to calculate fare from aiub to uttara , mohakhali , new bazar , dhanmondi and banani by car or taxi or cycle or bus or by walk. (input is ask me which vehicle i want to go)
distance from aiub is
uttara : 50km
mohakhali : 40km
new bazar : 20km
dhanmondi ": 30 km
banani : 10km
if by walk is possiible then output is by walk possbile .
n.b : by walk is not possible.

can anyone solve this ?
no, no one can. We need more info, like what the fares/costs are for each vehicle assuming its per mile and not affected by traffic or something. How far is too far to walk? I wouldn't walk any of them, esp if its hot outside. The question is too incomplete to resolve.
Just make up some numbers. Likely your teacher(?) is trying to see how you handle choices and variable calculations. You'd need a lot more distances, too, from each city to all others.

Come up with a way to store data like distances and fares for each vehicle, and leverage that to calculate different combinations.
Last edited on
#jonnin , its we suppose the cost & per kilo , by walk is not possible .
You still need more info, either made up yourself or from the assignment...
-how far is too far to walk?
if(choice == walk && distance_to_city >= too_far_to_walk)
cout << "too far to walk";

and how much it costs, eg
cout << "the price by bus is " << bus_cost_per_km * distance_to_city << endl; //need a value for the cost

or maybe something complex is in order for some of these:
time_taken_to_travel = speed_limit/traffic_factor * distance; //or whatever
cout << "the price by taxi is " << time_taken_to_travel * taxi_rate_per_time_unit << endl;

Last edited on
Topic archived. No new replies allowed.