/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERAug 24.2009 — Your code looks more like Java than Javascript. ?

Are you sure you are posting to the right forum

Answer to Query ratio may be really low on the JS forum. :eek:
×

Success!

Help @spacemoc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...