Computer problems,Computer help
*AX SOFT>>>Programming & Design

Can you help correct my java code?


I am making a java applet which will convert celcius to farenheight, and farenheigth to celcius, but right now I only have one. So first, can you help me correct my code because something is wrong with it when I compile it on jcreator 4.00 it shows several errors. Then after wards, can you help me find the second code I need...

import java.awt.Graphics;
import javax.swing.*;
public class temp extends JApplet
{
String type,Faren, out, name = "Jose Villarreal";
int 1=1,n,f;
double celcius

public void init()
{
type = JOptionPane.showInputDialog("Enter ur number ")

if (type == "F")
(

faren = JOptionPane.showInputDialog("What are your degrees farenheit:
f = Double.parseDouble(faren);
celcius = (5/9) * (f -32);
out = "the celcius temp is " + celcius;

)

import java.awt.Graphics;
import javax.swing.*;
public class temp extends JApplet
{
String type,Faren, out, name = "Jose Villarreal";
int 1=1,n,f;
double celcius

public void init()
{
type = JOptionPane.showInputDialog("Enter ur number ")

if (type == "F")
(

faren = JOptionPane.showInputDialog("What are your degrees farenheit:
f = Double.parseDouble(faren);
celcius = (5/9) * (f -32);
out = "the celcius temp is " + celcius;

)


}
public void paint (graphics g)
{
g.drawRect (15,25,270,100)
g.drawString(out,40,90);

}

}

(Here is the whole code, it didn't all appear the first time.)

type, out, name

Change type to typex, out to outx, and name to namex just to make sure you are not using reserved words.
-------------
double celcius needs a semicolon.
----------------
Is this cut off or not finished?

faren = JOptionPane.showInputDialog("W... are your degrees farenheit:

----------------
f = Double.parseDouble(faren);

faren is defined as a string Faren using uppercase.
----------------

Make sure all your lines have ';' to terminate them where needed. At first glance I can see at least 3-4 lines that need that.

I would recommend to do the code without the applet first.

The first answer was right, your double celcius variable doesn't have the ";", also, to do it the other way around, change all the variables to their opposite, that should work.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • For which one should i go for C++ or JAVA ?

    You can go for either of them it won't matter too much in the log term which language you select. But what will matter is how you build upon the base language. Look in Software Industry the...

  • Is Gimp good?

    I think your additional details answers your own question. It stresses you out because of the learning curve and because some printing technology is proprietary, and while Adobe takes responsibili...

  • Animation shop\Paint shop pro help please? (Glitter names)?

    due to limited colors and anti alias option, gif's don't have smooth edges, you could try saving as png instead, or increase size, icon still looks ok anyway, have fun,鈽?br> ..

    ...
  • What's the best software to use for making a website?

    Adobe Dreamweaver

    ...
  • SQL Query in coldfusion?

    Where are you getting your #newID# variable from? Session QueryString Cookie Object Double check it! Test your query? Make Sure your dataconnection is not lost? Really need more inf...

  • How can I make my own website with only .com for free???

    1 registration 2 copy right 3 $$$$ depends on you web content 4 sponsors 5 clients 6 u got you web

    ...
  • My SQL is free or not? If cost mean how much?

    Basic MySQL database engine is free, however there is also "Enterprise" edition, which is not free. It has total cost of ownership of $18,000 per year for 6 servers according to their we...

  • What website can I use?

    try www.hidemytrace.com

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster