Produce a pseudocode, a flowchart, and a program that computes for the toll charge of trucks entering San Miguel and exiting Tipo. The toll charge is P 73.55 per kilometer. San Miguel starts at km 0 and ends at Tipo at km 63. The toll charge is inclusive of 8.25% tax.
Sample run:
Welcome to Toll Plaza
Please pay: P 4633.65
Tax: P 353.14
Amount tendered: P 5000
Change: P 366.35
/*
Pseudocode
Start
Declare constant CHARGE to 73.55
Declare constant KM to 63
Declare constant TAX to 0.0825
Set totalPay to KM*CHARGE
Set tax to totalPay*TAX
Declare variable amount
Declare variable change
Display Welcome to Toll Plaza
Display Please pay
Display Tax
Display Amount tendered
Read amount
Set change to amount-totalPay
Display Change
Stop
*/
#include<iostream>
using namespace std; // for cout
void main(){
const float CHARGE=73.55;
const float KM=63;
const float TAX=0.0825;
float totalPay=KM*CHARGE;
float tax=totalPay*TAX;
float amount;
float change;
cout<<"Welcome to Toll Plaza\n";
cout<<"Please pay: P "<<totalPay<<"\n";
cout<<"Tax: P "<<tax<<"\n";
cout<<"Amount tendered: P ";
cin>>amount;
change=amount-totalPay;
cout<<"Change: P "<<change<<"\n";
cin>>totalPay;
}
Comments
Leave a comment