ok, here is the program specification:

The aim of the assignment is to develop an applet that displays the details of a range of mobile phones.


Model: R2D2 C3PO
Talk Time: 3 4
Standby Time: 5 6
Weight: 102 85
Bluetooth: No Yes
Price: 79.95 99.95

There are 5 models in total.

When the applet starts running, a price list is displayed showing the different mobiles available and their prices. It is possible to return to this list at any time by pressing the Price List button. When one of the other buttons is pressed, a description of the chosen model is displayed. This consists of the model name, talk time, standby time, weight and the mention of Bluetooth if the mobile uses it.

The program should consist of the classes Mobile and MobileShop (both in one file called MobileShop.java). The Mobile class should consist of appropriate attributes, a constructor, a method to display the description of the model, a method to display the name and price (i.e. the corresponding line in the price list) and a method to return the name of the model so that it can be used as a caption when the corresponding button is created. The Mobile objects should be created and stored in an array in the MobileShop class.

---------------------------------------------------------------

this is my code, but it doesnt work the way it should. so any help and advice would be much appreciated!!! :

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

public class Mobile extends Applet implements ActionListener {

public Button PriceList, R2D2, C3PO, UB40, WD40, RU18;
private int sbTime, tTime;
private int model;
private int weight;
private boolean hasBluetooth;
private double price;

public void init() {


PriceList = new Button ("Price List");
add (PriceList);
PriceList.addActionListener(this);

R2D2 = new Button ("R2D2");
add (R2D2);
R2D2.addActionListener(this);

C3PO = new Button ("C3PO");
add (C3PO);
C3PO.addActionListener(this);

UB40 = new Button ("UB40");
add (UB40);
UB40.addActionListener(this);

WD40 = new Button ("WD40");
add (WD40);
WD40.addActionListener(this);

RU18 = new Button ("RU18");
add (RU18);
RU18.addActionListener(this);
}

public void paint (Graphics g) {
g.drawString("R2D2 79.95", 200, 200);
g.drawString("C3PO 99.95", 200, 230);
g.drawString("UB40 129.95", 200, 260);
g.drawString("WD40 189.95", 200, 290);
g.drawString("RU18 219.95", 200, 320);

}

public void actionPerformed(ActionEvent event) {

if (event.getSource() == PriceList)

if (event.getSource() == R2D2)
//model = R2D2;
price = 200;
sbTime = 36;
tTime = 6;
hasBluetooth = true;
weight = 10;
if (event.getSource() == C3PO)

if (event.getSource() == UB40)

if (event.getSource() == WD40)

if (event.getSource() == RU18)

repaint();
}
}

class Model{

private int sbTime, tTime;
private int model;
private int weight;
private boolean hasBluetooth;
private double price;


public void paint (Graphics g) {
g.drawString("ModelName : "+model, 200, 200);
g.drawString("Price: "+price, 200, 230);
g.drawString("Standby Time (days): "+sbTime, 200, 260);
g.drawString("Talk Time (hours) "+tTime, 200, 290);
g.drawString("Bluetooth : "+hasBluetooth, 200, 310);
g.drawString("Weight : "+weight, 200, 330);
}
}