Answered step by step
Verified Expert Solution
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 addons, 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
Assume the following for this Fitness Gym program:
The program will process only customer.
There is a onetime enrollment fee of $
The Fitness Gym is limited to types of memberships and addons listed in the table below.
The customer can select only membership and addon
The prices are fixed as stated in the table:
Membership
Monthly Cost
Platinum
$
Gold
$
Basic
$
AddOns
Cost
Childcare
$
Personal Training
$
Specifications
Create a Java class called LastNameFirstNameAssignment within the CS project.
Follow CS Programming Assignments Policy"
Use proper indentation, follow naming conventions for variablesconstants comment code.
Create the design notebook with required sections, clearly labeling each section.
Use the assignment design notebook example on Canvas as a guide.
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.
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 addons
o Prompts user for addon
o If the addon is valid
Compute and display
Cost for the membership monthly cost
Cost for addon and enrollment fee onetime 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.
The code must handle invalid user selections for the following user inputs:
Membership selection in the st menu
o If an invalid membership option is entered
The code MUST print a message and END PROGRAM
Addon selection in the nd menu
o If an invalid addon 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 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 addon menu or ask the user for an addon option.
See output example # below.
Select a membership: or :
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 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 ifstatements.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started