If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Help with Methods

I am a beginner in Java. I have been learning java by myself during the last few weeks and facing some difficulties with a question i got from a collegue of mine who did java at uni level. I don't know have to work with methods and she can't remember as well. Could some please help me out ??

Question:-

A telephone cost plan:

Local calls are charged at $0.50 per minute(between 9a.m and 9pm). Long distance calls (> 200 miles) are charged at $1.10 per minute((between 9a.m and 9pm). From 9p.m to 9a.m,calls are charged at half the normal rate.

I have to write a program which calculates the total cost of an arbitrary number of calls. For each call, the person using the phone needs to enter a time value (in 24hr mode), a distance (in miles), and a call length (in minutes). The program must then display the cost of that call and also adds the cost onto a cumulative total.

When the phone user has no more calls to process, a time value of -999 instead of a legal time. When the program reads this sentinel value it displays the total cost of all the processed calls and ends.