CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Gym Membership

Threaded View

  1. #1
    Join Date
    Mar 2018
    Posts
    1

    Gym Membership

    So I am quite new to Java and I am looking for any pointers. I need to write a program to devise the membership of members to a gym.

    Need to work out cost of new members-this depends upon a level of membership
    Need to add a yearly cost to all members
    Need to add a joining fee

    So far this is what I have

    Code:
    import java.util.Scanner;                       // user input
    
    public class Gym
    {
        public static void main ( String[] args )
        {
            //  define constants
            final double generalmembership = 100;      
            final double studentmembership= 55;
            final double undereightmembership = 35;
            final double COMPETITION_FEE       = 10;        // fee all members pay
        
            //Input Variables 
            char type; // 'G' General membership or 'S' Student membership or 'U' for Under eighteen membership
    	
            //  Set up for user input
            Scanner input = new Scanner( System.in );
            /********************************************************************/
    
            // Read Inputs
            System.out.println ( "Please enter major ('G' for General Member, 'S' for Student or 'U' for Under Eighteen): " );
            type = input.nextLine().charAt(0);
            {
                //Cost of Memberships
                If (type == 'G' || type == 'g') {
                    type = 'G';
                }
                else if (type == 'S' || type == 's') {
                    type = 'S';
                }
                else if (type == 'U' || type == 'u') {
                }
    
                //Calculate membership costs
    Any pointers/criticism is welcome as I am here to learn and develop
    Last edited by 2kaud; March 10th, 2018 at 04:58 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured