
1.write a prograame to create applet which display text hello in bold ,text color should be red. 2.Write a programme that convert the temperature from Celsius to fahernheit. make use of the AWT. 3.write a prograame to create class person with variables name,sex,phone,email.Display the detail information of the two person's by using inheritance.

Hi Friend,
1) Try the following code:
import java.awt.*;
import java.applet.*;
public class StringColor extends Applet{
public void paint(Graphics g){
g.setColor(Color.red);
g.setFont(new Font(null,Font.BOLD,20));
g.drawString("Hello",100,100);
}
}
2)
import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
public class Converter extends Applet{
Label lab1,lab2;
TextField text;
Button button;
public void init(){
lab1=new Label("Enter temperature in Celsius: ");
text=new TextField(20);
button=new Button("Find");
Panel p=new Panel(new GridLayout(2,2));
Panel panel=new Panel();
p.add(lab1);
p.add(text);
p.add(button);
add(p);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String value=text.getText();
double c=Double.parseDouble(value);
double f=(c*1.8) + 32;
JOptionPane.showMessageDialog(null,"Temperature In Fahrenheit is: "+Double.toString(f));
}
});
}
}
3)For inheritance, visit the following:
http://www.roseindia.net/java/language/inheritance.shtml
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.