Hello, I am new here so Hi to everyone.
My name is Debbie and need help writing a pseudocode for the following program as Im a little confused, heres the program for code:
write a program that can be used to calculate the cost of a phone call. a call is local if the area code is 908, 732, 973, or 201.
for local calls, it is 6 cents per minute for calls that are 5 min or less, 5 cents for calls longer than 5 min, and up to 10 min, and 4 cents for calls longer than 10 min.

for long distance calls it is 12 cents per minute for calls 8 min or less and 9 cents per min that exceeds 8 min.
program should,
1. ask user to input area code, phone number, length of call
2 calculate cost of call
3 output the phone number, length of call and cost of call in seperate boxes with appropriate labels
this is sooo confusing, can anyone help???

Recommended Answers

All 5 Replies

Oh yeah, I know that input has to be tabbed in and all that, but when I get to the if then else on the compund desicion, im so lost, if someone could walk me thru this Id appreciate it I feel if I know why something has to be, then Ill understand it better and be able to do this-lol

Heres the code but it only calculates local calls. I have to leave the rest on you. :P

Dim LocalCall As Boolean
Dim CallMinute As Integer
Dim TotalCall As Integer
'this is to check if it is a local call
If txtArea.Text = "908" Or txtArea.Text = "732" Or txtArea.Text = "973" Or txtArea.Text = "201" Then
        LocalCall = True
Else
        LocalCall = False
End If


If LocalCall = True Then
    ' local call 5 minutes or less
    If Val(txtMinute.Text) <= 5 Then
        CallMinute = 6
    ' local call 6 minutes to 10 minutes
    ElseIf Val(txtMinute.Text) >= 6 And Val(txtMinute.Text) <= 10 Then
        CallMinute = 5
    Else
    ' local call 11 minutes above
        CallMinute = 4
    End If
Else
    'Long distance Call here
End If

'calculate call cos
TotalCall = CallMinute * Val(txtMinute.Text)
MsgBox (TotalCall)

Wow! How did you do that-lol. Thanks, Now I have to study this so I really get it!!

Glad to help and Please mark the thread closed. Thanks.

Ok, no problem, and thanks so much again!!:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.