English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have to make a program that converts Fahrenheit to celsius or Celsius to Fahrenheit in the program "Just Basic" Using FUNCTIONS I followed all steps and wrote the correct formulas for conversion but the problem is that it does not correctly convert here is the code I been working on not finished still testing.




PRINT "PLEASE ENTER THE CONVERSION YOU WANT TO OCCUR ? "
PRINT "PLEASE PRESS 1 TO CONVERT FAHRENHEIT TO CELCIUS OR PRESS 2 TO CONVERT CELCIUS TO FAHRENHEIT"
INPUT NUMBER
INPUT "PLEASE ENTER THE DEGREE TO CONVERT ";DEGREE
IF NUMBER = 1 THEN GOTO [FC]
IF NUMBER = 2 THEN GOTO [CF]

[FC]
LET CONVERTFC = CONVERT1(DEGREE)
PRINT "YOUR CONVERTED NUMBER FROM FAHRENHEIT TO CELCIUS IS " ;CONVERTFC;
[CF]
LET CONVERTCF = CONVERT2(DEGREE)
PRINT "YOUR CONVERTED NUMBER FORM CELCIUS TO FAHRENHEIT IS " ;CONVERTCF;











FUNCTION CONVERT1(n)
CONVERT1 = 5/9 * (DEGREE - 32)
END FUNCTION

FUNCTION CONVERT2(m)
CONVERT2 = 9/5 * DEGREE + 32
END FUNCTION

2007-02-16 10:48:29 · 3 answers · asked by Mike 3 in Computers & Internet Programming & Design

Sorry first two answers dont work.

2007-02-16 11:01:48 · update #1

Thanks Vegan for your help I got it to work.

2007-02-16 13:31:26 · update #2

Answer one works

2007-02-16 13:36:55 · update #3

3 answers

In your functions you need to replace the word DEGREE with n and m.

Like so:

FUNCTION CONVERT1(n)
CONVERT1 = 5/9 * (n - 32)
END FUNCTION

FUNCTION CONVERT2(m)
CONVERT2 = 9/5 * m + 32
END FUNCTION

You need to be a bit more descriptive than "It doesn't work."

You also may need to put the functions at the beginning of the program instead of the end.

2007-02-16 10:53:02 · answer #1 · answered by Vegan 7 · 1 0

I would do it, but i don't have time, but i can suggest you to get the math formula from a math or science book, this is pretty easy and straight operation just replace values celcious for farengeith and see how it works and then apply the same math calculations to the programming language you are using to do the same. you can't go wrong.

2007-02-16 11:19:57 · answer #2 · answered by Anonymous · 0 1

try this
CONVERT1 =(5/9) * (DEGREE - 32)

CONVERT2 = (9/5)* DEGREE + 32

2007-02-16 10:53:09 · answer #3 · answered by OverShiNe 2 · 0 1

fedest.com, questions and answers