
-----------------------------------
BiggZigg9
Thu Jan 20, 2011 4:42 pm

Heeelllllp
-----------------------------------
why is the total showing two answers!?

var tod : int := 0
var day : int := 0
var phone : int := 0
var key : string (1)
var total : int := 0
var restart : string (1)
loop
%Main menu
put "***************************"
put "BELL LONG DISTANCE BILLING"
put "***************************"
put "Click any key to begin"
getch (key)
cls
%Finding the day the call was made on
put "Please enter the day of the week that your call was made (Day 1,2,3,4,5,6 or 7)"
get day

if day = 1 then
    put "Your call was made on Monday"
end if
if day = 2 then
    put "Your call was made on Tuesday"
end if
if day = 3 then
    put "Your call was made on Wednesday"
end if
if day = 4 then
    put "Your call was made on Thursday"
end if
if day = 5 then
    put "Your call was made on Friday"
end if
if day = 6 then
    put "Your call was made on Saturday"
end if
if day = 7 then
    put "Your call was made on Sunday"
end if
delay (1000)
put "Hit any key to continue calculating your phonebill"
getch (key)
cls
%Time of day call was made (TOD)
put "What time of the day was your call made at?"
put "1)8:00 - 18:00"
put "2)18:00 - 23:00"
put "3)23:00 - 8:00"
get tod
put "Hit any key to continue calculating your phonebill"
getch (key)
cls
%Length of phone call
put "How many minutes was your phone call. *Remember that 61 seconds is equal to 2 minutes, 1 second is equal to 1 minute, ect."
get phone
put "Hit any key to get the total of your phone bill"
getch (key)
cls
put "Loading"..
delay (500)
put "."..
delay (500)
put "."..
delay (500)
put "."..
delay (500)
put "."..
delay (500)
put "."
delay (1099)
%Totals
if day > 5 then
    put "Your total cost for the call is $,", phone * .168 : 0 : 2
end if

if day < 5 then
end if
if tod = 1 then
    put "Your total cost for this call is $", phone * .42 : 0 : 2
end if
if tod = 2 then
    put "Your total cost for this call is $", phone * .273 : 0 : 2
end if
if tod = 3 then
    put "Your total cost for this call is $", phone * .168 : 0 : 2
end if
delay(1000)
%Option to start over
put "Enter y to calculate another call, or exit the program" 
getch (restart) 
if restart = ('y') then 
end if
cls
end loop

-----------------------------------
Insectoid
Thu Jan 20, 2011 4:50 pm

RE:Heeelllllp
-----------------------------------
I don't know what this code does. I don't know what 'the total' is. No, I won't just run your code and see for myself, because I'm lazy. You need to give us information to work with.

Also, you may want to rethink your title.

-----------------------------------
Tony
Thu Jan 20, 2011 4:51 pm

RE:Heeelllllp
-----------------------------------
Because more than 1 of your if statements evaluates to true.

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 4:52 pm

RE:Heeelllllp
-----------------------------------
okay so what it has to do is calculate the price oh a long distance call.

-----------------------------------
Tony
Thu Jan 20, 2011 4:56 pm

RE:Heeelllllp
-----------------------------------
What you have to do is figure out which 2 "totals" are printed and under what conditions both of their if statements are satisfiable (able to evaluate to true).

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 4:57 pm

RE:Heeelllllp
-----------------------------------
sorry can u dumb it down. im very new to turing

-----------------------------------
Tony
Thu Jan 20, 2011 4:59 pm

RE:Heeelllllp
-----------------------------------
You have 4 different "put "Your total cost". Which 2 of those 4 are being printed?

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 5:13 pm

RE:Heeelllllp
-----------------------------------
it depends on what the user puts in

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 5:16 pm

RE:Heeelllllp
-----------------------------------
it depends on what the user puts in

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 5:36 pm

RE:Heeelllllp
-----------------------------------
can soremone PLEASE correct it!. im desperate!

-----------------------------------
Tony
Thu Jan 20, 2011 5:53 pm

Re: RE:Heeelllllp
-----------------------------------
I already told you what the problem is, and what you can do to figure out the details of it.
What you have to do is figure out which 2 "totals" are printed and under what conditions both of their if statements are satisfiable (able to evaluate to true).

-----------------------------------
BiggZigg9
Thu Jan 20, 2011 7:03 pm

RE:Heeelllllp
-----------------------------------
I dont know what that means:(

-----------------------------------
ProgrammingFun
Thu Jan 20, 2011 7:16 pm

RE:Heeelllllp
-----------------------------------
It's really not that hard to figure out...
You have two if statements validating instead of one...
To fix this, read through all of your if statements to make sure that they are doing what you want them to do.

-----------------------------------
Dragon20942
Fri Jan 21, 2011 4:39 pm

RE:Heeelllllp
-----------------------------------

if day > 5 then 
put "Your total cost for the call is $,", phone * .168 : 0 : 2 
end if 
if day < 5 then 
end if 
if tod = 1 then 
put "Your total cost for this call is $", phone * .42 : 0 : 2 
end if 
if tod = 2 then 
put "Your total cost for this call is $", phone * .273 : 0 : 2 
end if 
if tod = 3 then 
put "Your total cost for this call is $", phone * .168 : 0 : 2 
end if 

Thats the problem, you cant get any plainer than that.
