Notices
Off-topic Cafe Meet the others and talk about whatever...

Java Homework please help

Thread Tools
 
Search this Thread
 
Old Mar 1, 2007 | 05:07 PM
  #1  
XB_BOB's Avatar
Thread Starter
Senior Member
10 Year Member
5 Year Member
SL Member
 
Joined: Jul 2005
Posts: 153
From: Frederick MD
Default Java Homework please help

So for extra credit i need to make this temperature conversion applet allow user to input either degrees C* of F* and output the opposite unit.

this is what i have so far. Any suggestions


import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class TempConvert extends Applet implements ActionListener
{
double F, C;
Label prompt;
TextField input;

public void init()
{
prompt = new Label ("Enter the Temperature in degrees fahreinheit:");
add(prompt);

input = new TextField(5);
add(input);

input.addActionListener(this);
}
public void actionPerformed (ActionEvent e)
{
F = Integer.parseInt(input.getText());
C = F - 32 * 5 / 9;
repaint();
}

public void paint (Graphics g)
{
g.drawString ("the current Temperature is " + C +"degrees celcius.",70,75);
setBackground(Color.green);
}
}
Old Mar 1, 2007 | 05:12 PM
  #2  
kanundrum's Avatar
Senior Member
10 Year Member
5 Year Member

SL Member
 
Joined: Jun 2005
Posts: 5,114
From: Laurel, MD
Default

I got the psuedo code at home and this written in C++. Ill post up when I get home it should help, the only other problem would be any syntax errors.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
java09
Scion tC 1G ICE & Interior
99
Oct 14, 2009 04:49 PM
java09
Scion tC 1G Forced Induction
2127
Sep 24, 2009 03:40 PM
pixiedixie862
Regional - Pacific South
14
Nov 5, 2007 10:11 PM
YELOSUB
Scion xA/xB 1st-Gen Wheel & Tire
2
Jul 17, 2006 01:57 AM
dante
Buyer / Seller Experiences
53
Nov 30, 2004 08:23 PM




All times are GMT. The time now is 04:26 AM.