Hello,
I have got this question and that’s what I have got but it’s doesnt work:
QUESTION: A program is to be written to store Gym registration details. A Gym member record consists of membership number, name, postcode and fee.
Write a class definition to represent such Gym membership details.
Write a main method that declares and initialises two new Gym membership objects.
Write a method to request data items from the user to fill both the new Gym member objects.
Write a method to display to the screen the names and membership numbers of both members.
Example data entry ( “Z123456”, “Paul Jones”, “HN78HG”, 250);
My Code:
// Skeleton_test2
// Janet Rix 22/11/07
import javax.swing.JOptionPane;
class Objects_arrays
{
int mem_num;
String name;
char postcode;
int fee;
// declare class variables
// constructor
{
int mem_num = JOptionPane.showInputDialog(“Enter membership number”);
String name = JOptionPane.showInputDialog(“Enter the name of new member”);
char postcode = JOptionPane.showInputDialog(“What is the postcode of the new member?”);
int fee = JOptionPane.showInputDialog(“Enter the fee of new member”);
}
// set method – to obtain information from user
public static void Member1 (mem_num, name, postcode, fee);
{
mem_num = 15215;
name = Michael;
postcode = NW18HP;
fee = 250;
}// end method
System.out.println(“Membership datails:” + Member1);
// print method
public static void main(String[] args)
{
int [] gym_mem;
Weight kg = new int [78];
Height ft = new int [6];
System.out.println(“Member’s weight is:” + Weight);
// call print method for object 1
System.out.println(“Member’s Height is:” + Height);
// call print method for object 2
System.exit(0);
} // end main method
} // end class Skeleton_test2