Hi all,
I'm new to Java.
I'm having a problem with a program which will compile but not run.
When I run it, I get the following error:
java.lang.NoSuchMethodError: main
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
The name of the program is the name of the "main" class.
Any help would be greatly appreciated.
The program with the problem is as follows:
/***********************************************
* Name:
* Purpose:
*
*
* Date: 07/22/2005
* Author:
* References: None
**************************************************/
import cs1.Keyboard;
import java.io.*;
class People
{
String name;
double height;
double weight;
String sex;
public People()
{
name = " ";
height = 0.00;
weight = 0.00;
sex = " ";
}
public People(String name, double height, double weight, String sex)
{
this.name = name;
this.height = height;
this.weight = weight;
this.sex = sex;
}
public void BodyMassIndex()
{
double bmi = 0.00;
bmi = weight /(height * height);
System.out.println("test: bmi"+bmi+" "+name+" "+height+" "+weight);
}
}
class PatientBMI
{
public void main(String[] args) throws IOException
{
int numclasses = 0;
boolean i = true;
while (i)
{
People patient = new People();
System.out.println("Enter the following information for the patient: ");
System.out.print(" Full name: ");
patient.name = Keyboard.readString();
System.out.print("\n");
System.out.print(" Height: ");
patient.height = Keyboard.readDouble();
System.out.print("\n");
System.out.print(" Weight: ");
patient.weight = Keyboard.readDouble();
System.out.print("\n");
System.out.print(" Weight: ");
patient.sex = Keyboard.readString();
System.out.print("\n");
patient = new People(patient.name, patient.height, patient.weight, patient.sex);
patient.BodyMassIndex();
}
}
}
Thanks,