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

Whats wrong with my 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.

This line is illegal:
int 1=1,n,f;
as "int" is used to declare a variable of type integer. You could always try saying
int one = 1;
int f;

but I have no idea what the n is doing there.
It's difficult to figure out what else is wrong with your code as it's not formatted correctly. I suggest checking to make sure that each opening parenthesis has a closing one and that each line (excluding if statements and fuction declarations) ends with a semi-colon ;

Try removing the line break between those two lines and ensure the string has close quotes as well.

Rename type, out and name to make sure you are not using reserved words.

Given how screwed up the syntax of this program is, I'd guess that you didn't actually write it, but copied it from some other source.

Start over with the minimal code you need to get it to compile, then add code to prompt the user and display the result. Make sure you understand what you're doing at each step, and you'll be a lot better off.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • I just moved my asp.net app. project over the devlopment server but having issue with login. unable to loging?

    What kind of authentication are you using? Windows authentication? Forms authentication? A custom solution? I'm lead to believe that perhaps you're using Windows authentication, and th...

  • How can a computer be random?

    hehe, good question. The answer is it can't. In the absence of this, 'pseudorandom' is good enough. If it appears random to us, what's the difference? A common technique use...

  • How do i enable java script on my laptop?

    In firefox you go to tools options content. Then click the check box next to enable java script. In internet explorer you go to tools internet options then click the security tab, set your own cust...

  • What u say about it...???

    Very nice. You will be a successful web designer when you finish school. As the other said, the content has bad spelling and grammar which should be reviewed.

    ...
  • I want visitors to be able to post comments on my webpage and have other visitors view them, is there a way?

    ...

  • What can I do to fix my java applet code?

    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.show...

  • 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

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster