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

What can I do to fix my java applet code?


Making celcius to farenheight java applet.

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

public void init()
{
typex = JOptionPane.showInputDialog("Enter ur number ")
;
if (type == "F")


Faren = JOptionPane.showInputDialog("X:
) f = Double.parseDouble(Faren);
celcius = (5/9) * (f -32);
outx = "the celcius temp is " + celcius;


;

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

}

}

(jcreator is telling me something is wrong with the following:

<identifier> expected line 6


unclosed string literal : line 16

and

')' expected line 17

I dont understand how to correct these.

Faren = JOptionPane.showInputDialog("X:
) f = Double.parseDouble(Faren);

That's 2 line's of code, and you didn't close your String. Change to...

Faren = JOptionPane.showInputDialog("X:");
f = Double.parseDouble(Faren);

Also, don't compare strings using ==, use String.equals() method.
if (type == "F") change to... type.equals("F")

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Whats a good program to make a banner for a website?

    i've been doing banners at skool for my it coursework and i had to use dreamweaver to do it

    ...
  • I think I might have a bug in my control panel programme?

    have you run your security you could take windows back and you will loose nothing from your pc , e-mail me if you want to

    ...
  • What should I learn first?

    Men, take it easy. If you want to learn something in life, you've got to start by the smallest things, and them move on to the bigger ones. Web-design is a whole-thing, big action range. Th...

  • Easy CSS points: border-collapse: separate; What's border-collapse? What other things (ie: seperate) can use?

    It looks as though it literally collapses borders together, i.e., it merges the table border with the cell border. You can "separate" them or "collapse" them.

    ...
  • CSS, easy points: What is ".FIXFIREFOX {}html:not([dummy]) " referring to? The entire thing?

    As I cannot see the rest of the code you took this from I can only answer your question in a general sense. The line of code you provided in your question is a CSS filter which is targetting the...

  • CSS, easy points: I need to know what this block of CSS code does?

    The "FIX_OPERA" part is a workaround for people who use the Opera web browser. It says that the smallest width that all media (images, boxes etc) with this name can be is 0px. It also me...

  • Which is the easiest web site building software?

    Microsoft front page. If u want to build a website, ill make one for u absolutely free :) i love web designing, email me if u r interested syedmohsin2k2@hotmail.com

    ...
  • How agile method works in the software development?

    Agile software development is a conceptual framework for software engineering that promotes development iterations throughout the life-cycle of the project. There are many agile development meth...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster