William Langly

William Langly

  • 1.9k
  • 32
  • 2.7k

Having Trouble With Array

Oct 25 2017 11:56 AM
I need help writing a program that stores the area codes and rates in parallel arrays and allows a user to enter an area code and the length of time for a call in minutes, and then display the total cost of the call.
 
For example if the area code is in the array, such as 715, and the call length is 22 minutes, the output should be:
 
Your phone call to area 715 costs $0.16 per minute For 22 minutes the total is $3.52
 
If the area code is not in the array, such as 111, the program should not accept a call length, and instead output "Sorry - no calls allowed to area 111". 

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (1)