Azeem Telco Sdn. Bhd charges file, contains records for each call made by its subscribers during a month. Each record on a file contains the subscriber’s name and phone number, the phone number called, the distance from Shah Alam of the number called (in kilometers) and duration of the call-in seconds.
As a junior programmer, you are required to design and write a complete C++ program that asked the user to enter subscriber’s name and phone number, the phone number called, the distance from Shah Alam of the number called (in kilometers) and duration of the call-in seconds. The user also needs to enter types of call either Local or International call.
The cost of each call is calculated based on Table 1.
Distance from Shah Alam
Less than 25 km
25 <=km<75
75 <=km<300
300 <= km <=1000 Greater than 1000 km
Cost(RM)/minute
Local International 0.35 0.55 0.65 0.85 1.00 1.20 2.00 2.20 3.00 3.20
Your program should use the following:
1. Appropriate Control Structure
2 User Defined Function
void Distance(int dist, double internation)
{
cin >> dist;
if (dist <= 25 && dist < 75)
{
internation = 0.35;
}
else if (dist <= 75 && dist < 300)
{
internation = 0.55;
}
else if (dist <= 300 && dist <= 1000)
{
internation = 0.65;
}
else if (dist > 1000)
{
internation = 0.85;
}
}
int main()
{
int d;
double inter;
Distance(d, inter);
}
Comments
Leave a comment