Thread: Help!
View Single Post
Old Oct 14th, 2004, 4:05 AM   #1
Darren
Newbie
 
Join Date: Sep 2004
Posts: 10
Rep Power: 0 Darren is on a distinguished road
i done this program,but when i execute the program,computer will display
"Exception in thread" main"java.lang.NosuchMethodError:main"
y ah? any 1 can help me??

Below are my coding

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Project extends JApplet implements ActionListener
{
CheckboxGroup p = new CheckboxGroup();
Checkbox NONE = new Checkbox("NONE",p,true);
Checkbox LAN1001 = new Checkbox("LAN1001",p,false);
Checkbox LAN1003 = new Checkbox("LAN1003",p,false);
Checkbox LAN1005 = new Checkbox("LAN1005",p,false);
JTextField name, icno, csc230, csc231, csc239, mgt227, enl205,
result1, result2, result3, result4, lan1;
JButton Calculatebutton;
public void init()
{
Container container= getContentPane();
JLabel data1Label= new JLabel ("BMS SEM1");
JLabel space2Label= new JLabel ("");
JLabel dataLabel= new JLabel (" Please enter your marks to get your grade:");
JLabel spaceLabel = new JLabel ("");
JLabel nameLabel= new JLabel ("Student name");
JLabel icnoLabel = new JLabel ("ICNO");
JLabel space1Label= new JLabel ("");
JLabel csc230Label= new JLabel ("CSC230");
JLabel csc231Label= new JLabel ("CSC231");
JLabel csc239Label= new JLabel ("CSC239");
JLabel mgt227Label= new JLabel ("MGT227");
JLabel enl205Label= new JLabel ("ENL205");
JLabel spaceLabel2= new JLabel (" ");
JLabel info= new JLabel ("if you are not taking please enter 0 in the textbar:");
JLabel spaceLabel1= new JLabel ("");

name= new JTextField (20);
icno= new JTextField (20);
csc230= new JTextField (7);
csc231= new JTextField (7);
csc239= new JTextField (7);
mgt227= new JTextField (7);
enl205= new JTextField (7);
result1= new JTextField (75);
result2= new JTextField (75);
result3= new JTextField (75);
result4= new JTextField (75);
lan1= new JTextField (7);
Calculatebutton= new JButton ("Enter");
container.setLayout (new FlowLayout (FlowLayout.LEFT));
container.add (data1Label);
container.add (space2Label);
container.add (dataLabel);
container.add (spaceLabel);
container.add (nameLabel);
container.add (name);
container.add (icnoLabel);
container.add (icno);
container.add (space1Label);
container.add (csc230Label);
container.add (csc230);
container.add (csc231Label);
container.add (csc231);
container.add (csc239Label);
container.add (csc239);
container.add (mgt227Label);
container.add (mgt227);
container.add (enl205Label);
container.add (enl205);
container.add (spaceLabel2);
container.add (info);
container.add (spaceLabel1);
container.add (NONE);
container.add (LAN1001);
container.add (LAN1003);
container.add (LAN1005);
container.add (lan1);
container.add (result1);
result1.setEditable (false);
container.add (result2);
result2.setEditable (false);
container.add (result3);
result3.setEditable (false);
container.add (result4);
result4.setEditable (false);


Calculatebutton.addActionListener (this);
container.add (Calculatebutton);
}

public void actionPerformed (ActionEvent e)
{
String g1, g2, g3, g4, g5, ag, lann1;
float avg, total;
float a =Integer.parseInt (csc230.getText());
float b =Integer.parseInt (csc231.getText());
float c =Integer.parseInt (csc239.getText());
float d =Integer.parseInt (mgt227.getText());
float x =Integer.parseInt (enl205.getText());
float la1=Integer.parseInt (lan1.getText());
String y = icno.getText();
String z = name.getText();

if(a<=100 && a>70)
g1 = "A";
else if(a<=69 && a>50)
g1 = "B";
else if(a<=50 && a>40)
g1 = "C";
else
g1 = "D";

if(b<=100 && b>70)
g2 = "A";
else if(b<=69 && b>50)
g2 = "B";
else if(b<=50 && b>40)
g2 = "C";
else
g2 = "D";

if(c<=100 && c>70)
g3 = "A";
else if(c<=69 && c>50)
g3 = "B";
else if(c<=50 && c>40)
g3 = "C";
else
g3 = "D";

if(d<=100 && d>70)
g4 = "A";
else if(d<=69 && d>50)
g4 = "B";
else if(d<=50 && d>40)
g4 = "C";
else
g4 = "D";

if(x<=100 && x>70)
g5 = "A";
else if(x<=69 && x>50)
g5 = "B";
else if(x<=50 && x>40)
g5 = "C";
else
g5 = "D";

total = a + b + c + d + x;
avg = total / 5;

if(avg<=100 && avg>70)
ag = "A";
else if(avg<=69 && avg>50)
ag = "B";
else if(avg<=50 && avg>40)
ag = "C";
else
ag = "D";


if(la1<=100 && la1>70)
lann1 = "A";
else if(la1<=69 && la1>50)
lann1 = "B";
else if(la1<=50 && la1>40)
lann1 = "C";
else
lann1 = "D";





Object Source=e.getSource();
if (e.getSource()==Calculatebutton)
{

result1.setText ("Your name is "+z+", your ic number is "+y);
result2.setText (" your CSC230 grade is " +g1+", CSC231 grade is "+g2+", CSC239 grade is "+g3+", MGT227 grade is "+g4+", and ENL205 grade is "+g5);
result3.setText (" your total marks of all subjects is " +total+ " your average mark is " +avg+ " and your average grade is " +ag);
Checkbox cb = p.getSelectedCheckbox();
String mode = cb.getLabel();
if(mode.equals("NONE"))
result4.setText("you don't have taken LAN subject in this semester");
else if(mode.equals("LAN1001"))
result4.setText("you are taking LAN1001 and your grade is "+lann1);
else if(mode.equals("LAN1003"))
result4.setText("you are taking LAN1003 and your grade is "+lann1);
else if(mode.equals("LAN1005"))
result4.setText("you are taking LAN1005 and your grade is "+lann1);
}
}
}
Darren is offline   Reply With Quote