no magic number  public class GolfClubMember {     // Constants for driving range basket costs     public static double SMALL_BASKET_COST = 7.0;     public static double MIDIUM_BASKET_COST = 11.0;     public static double LARGE_BASKET_COST = 15.0;          // Constants for game costs     public static double TWILIGHT_GAME_COST = 15.0;     public static double REGULAR_GAME_COST = 17.0;          // Step 2: Declare two instance variables     //            name: String     //            balance: double                // Step 3: Write the following constructor      //         according to the description     /**      * The constructor has two parameters to initialize      * the instance variables.      *       * @param nameParam the name of this golf club member      * @param balanceParam the balance of this golf club member      */          // Step 4: Override method toString() according to the description     /**      * Gets a string representaton for this golf club member in the      * following format:      *          GolfClubMember[Name:Mike,Balance:390.0]      *      * @return a string containing the name and balance       *         of this golf club member      */     @Override           // Step 5: Write method drivingRange() according to the description     /**      * When you go to a golf driving range, you need to pay to get       * a basket of golf balls.      *      * The method has one parameter for the size of the basket and       * it reduces the balance of this golf club member based on       * the basket size.      * There are three different sizes, "small", "medium", and      * "large", but anything other than "small" or "medium" will       * be considered "large".      * The cost is SMALL_BASKET_COST, MIDIUM_BASKET_COST      * and LARGE_BASKET_COST, respectively.      *      * @param size the size of the basket.       */     // Step 6: Write method playingGame() according to the description     /**      * When you play a golf game, you pay for the game to play.      *      * The method has one parameter for the type of game to play      * and it reduces the balance of this golf club member based      * on the game type.      * The type is either "regular" or "twilight", but anything       * not "regular" will  be considered as "twilight".       * The cost is REGULAR_GAME_COST and TWILIGHT_GAME_COST,      * respectively.      *      *       */ }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

no magic number 

public class GolfClubMember
{
    // Constants for driving range basket costs
    public static double SMALL_BASKET_COST = 7.0;
    public static double MIDIUM_BASKET_COST = 11.0;
    public static double LARGE_BASKET_COST = 15.0;
    
    // Constants for game costs
    public static double TWILIGHT_GAME_COST = 15.0;
    public static double REGULAR_GAME_COST = 17.0;
    
    // Step 2: Declare two instance variables
    //            name: String
    //            balance: double 
    
    
    // Step 3: Write the following constructor 
    //         according to the description
    /**
     * The constructor has two parameters to initialize
     * the instance variables.
     * 
     * @param nameParam the name of this golf club member
     * @param balanceParam the balance of this golf club member
     */

    
    // Step 4: Override method toString() according to the description
    /**
     * Gets a string representaton for this golf club member in the
     * following format:
     *          GolfClubMember[Name:Mike,Balance:390.0]
     *
     * @return a string containing the name and balance 
     *         of this golf club member
     */
    @Override 

    
    // Step 5: Write method drivingRange() according to the description
    /**
     * When you go to a golf driving range, you need to pay to get 
     * a basket of golf balls.
     *
     * The method has one parameter for the size of the basket and 
     * it reduces the balance of this golf club member based on 
     * the basket size.
     * There are three different sizes, "small", "medium", and
     * "large", but anything other than "small" or "medium" will 
     * be considered "large".
     * The cost is SMALL_BASKET_COST, MIDIUM_BASKET_COST
     * and LARGE_BASKET_COST, respectively.
     *
     * @param size the size of the basket. 
     */


    // Step 6: Write method playingGame() according to the description
    /**
     * When you play a golf game, you pay for the game to play.
     *
     * The method has one parameter for the type of game to play
     * and it reduces the balance of this golf club member based
     * on the game type.
     * The type is either "regular" or "twilight", but anything 
     * not "regular" will  be considered as "twilight". 
     * The cost is REGULAR_GAME_COST and TWILIGHT_GAME_COST,
     * respectively.
     *
     * 
     */

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY