How should I edit my C++ code below? It displays the incorrect math answer to the fare. //PASSENGER’S FARE #include using namespace std; int main(){ float distance_km, fare; int passenger, vehicle,...


How should I edit my C++ code below? It displays the incorrect math answer to the fare.



//PASSENGER’S FARE


#include


using namespace std;
int main(){
float distance_km, fare;
int passenger, vehicle, vehicle_opt;


cout < "enter="" the="" distance="" in="" kilometers:="">
cin >> distance_km;


cout < "choose="" the="" type="" of="" vehicle:="" "=""><>
cout<"1.><>
cout<"2.><>
cin >> vehicle;


cout < "choose="" the="" type="" of="" passenger:="" "=""><>
cout<"1.><>
cout<"2.><>
cout<"3.><>
cout<"4. person="" with=""><>
cin >> passenger;


switch(vehicle_opt)
{
case 1:
fare = 40 + 15*(distance_km - 1);


break;


case 2:
if(passenger==1){
fare = 7.50 + (1.15)*(distance_km - 4);



}else{
fare = 6.00 + (0.92)*(distance_km - 4);


}
break;
}
cout<>
cout< "passenger's="" fare:="" "=""><>


return 0;


}


Sy Lines is one of the most famous and<br>trusted transportation vehicles in the<br>region. They offer 2 types of vehicles that<br>the commuters can choose: (1) Taxi and (2)<br>Jeepney.<br>The base fare for the taxi is Php 40.00 and<br>additional Php 15 for each km.<br>For the jeepney, the fare is Php 7.50 for the<br>regular passengers and Php 6.00 for the<br>students & senior citizen for the first 4km.<br>Succeeding km will be charged Php 1.15/<br>km and Php 0.92/km respectively.<br>Write a program that will compute and<br>display the passengers fare given the<br>distance (km) and the type of passenger<br>(Regular & Student/Senior/PWD).<br>

Extracted text: Sy Lines is one of the most famous and trusted transportation vehicles in the region. They offer 2 types of vehicles that the commuters can choose: (1) Taxi and (2) Jeepney. The base fare for the taxi is Php 40.00 and additional Php 15 for each km. For the jeepney, the fare is Php 7.50 for the regular passengers and Php 6.00 for the students & senior citizen for the first 4km. Succeeding km will be charged Php 1.15/ km and Php 0.92/km respectively. Write a program that will compute and display the passengers fare given the distance (km) and the type of passenger (Regular & Student/Senior/PWD).
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here