MonthlyTelephoneBill

The main method that begins by prompting the user to enter the cost per minute for local calls. It should repeatedly process calls. It should prompt the user for the type of call, either local or long distance and the length of the call in minutes. It should then call processLocal or processLongDistance as appropriate. After the cost of each call has been calculated, the total cost thus far for local and long distance service should be accumulated. Then it should prompt the user to determine whether there are more calls to process. After all calls have been processed, it should compute and display the monthly total. Assume that there is a $5.00 minimum for long distance service.
A method called processLocal that is passed the call length and the cost per minute. The maximum cost for any local call is $2.00. It calculates, displays and returns the cost of the call.
A method called processLongDistance that is passed the call length. Long distance calls are charged at $1.00 for the first twenty minutes, meaning all long distance calls cost at least $1.00. Calls longer than twenty minutes are charged five cents per minute thereafter. It calculates, displays and returns the cost of the call.
Input and output for this program should be done using the showInputDialog and showMessageDialog methods of the JOptionPane class.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×
New Download