Question: / / Define parallel arrays for area codes and rates int [ ] areaCodes = { 2 6 2 , 4 1 4 , 6
Define parallel arrays for area codes and rates
int areaCodes ;
double rates ;
Ask for user input
Console.WriteEnter the area code: ;
int areaCode Convert.ToIntConsoleReadLine;
Console.WriteEnter the length of the call in minutes: ;
double minutes Convert.ToDoubleConsoleReadLine;
Find the area code in the array and calculate the cost
bool areaCodeFound false;
for int i ; i areaCodes.Length; i
if areaCode areaCodesi
double cost ratesi minutes;
Console.WriteLine$"Your phone call to area areaCode costs $ratesi:C per minute";
Console.WriteLine$"For minutes minutes the total is $cost:C;
areaCodeFound true;
break;
Area code not found
if areaCodeFound
Console.WriteLine$"Sorry no calls allowed to area areaCode;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
