Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Description Create a simple Fitness Gym that allows a user to select a membership, possible add - ons, and view the final cost. The

Assignment Description
Create a simple Fitness Gym that allows a user to select a membership, possible add-ons, and view the final cost. The program displays the type of membership the user selects, any add on that is selected, the enrollment fee, and total cost. The program must handle invalid user selections as described below in step 6.
Assume the following for this Fitness Gym program:
The program will process only 1 customer.
There is a one-time enrollment fee of $20.00
The Fitness Gym is limited to 3 types of memberships and 2 add-ons listed in the table below.
The customer can select only 1 membership and 1 add-on.
The prices are fixed as stated in the table:
Membership
Monthly Cost
Platinum
$29.99
Gold
$19.99
Basic
$9.99
Add-Ons
Cost
Childcare
$5.00
Personal Training
$20.00
Specifications
1. Create a Java class called LastNameFirstNameAssignment3 within the CS1150 project.
2. Follow "CS1150 Programming Assignments Policy"
Use proper indentation, follow naming conventions for variables/constants, comment code.
Create the design notebook with required sections, clearly labeling each section.
Use the assignment 2 design notebook example on Canvas as a guide.
3. Use correct data types and use constants where possible:
Use constants for numeric literals that will not change while the code runs.
See Must Do and Tips section for an example regarding the use of constants.
4. Write code in main that:
Displays a menu with the different types of memberships
Prompts the user for the type of membership
If the type of membership is valid
o Display a menu with the possible add-ons
o Prompts user for add-on
o If the add-on is valid
Compute and display
Cost for the membership (monthly cost)
Cost for add-on and enrollment fee (one-time costs)
Total amount due today
See output section below for an example run of the code.
See Must Do and Tips section for more details about properly structuring the code.
5. The code must handle invalid user selections for the following 2 user inputs:
Membership selection in the 1st menu
o If an invalid membership option is entered
The code MUST print a message and END PROGRAM
Add-on selection in the 2nd menu
o If an invalid add-on option is entered
The code MUST print a message and END PROGRAM
Note:
o End program means: if a user input error occurs, the program must display an error message and perform no more processing.
o For example:
If the user enters 0 when asked to select a membership in the menu, the program must display an error message and complete execution.
At this point, the code must NOT display the add-on menu or ask the user for an add-on option.
See output example #3 below.
Select a membership: 1,2, or 3: 0
0 is not a valid menu item. Please run program again, goodbye!
o Use NESTED IF statements to make program termination occur properly.
DO NOT use System.exit(0) to exit program if an error occurs.
DO NOT use break or return statements if an error occurs.
The purpose is to learn to write properly nested if-statements.
Using System.exit, return, break statements will result in loss of points.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started