Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives: After successfully completing this assignment, students will practice the various ways Java programs can make decisions. Students will create a program that will evaluate
Objectives: After successfully completing this assignment, students will practice the various ways Java programs can make decisions. Students will create a program that will evaluate several compounded conditions and produce a formatted output accordingly. Assignment 4: King's Island King's Island is an amusement park that needs a program for its selling booths. Important Suggestion: Before your start, read the assignment's description in detail and then create a flow chart with your planned program logic. This is a very important step that will save you from making mistakes and spending extra-time in your program. When the logic for your program is clear, write a program in Java for the attendants that will calculate how much to charge visitors of the park based on different conditions. Your program will prompt the user to enter their information, calculate the cost of the ticket based on conditions, and display it on the screen. Program conditions: Class should be named "Assignment4" There is one ticket base price of $100.00. Senior citizens (age > 65) are given a 50% discount over the base price. Children under 4 (less than 4, not less than or equal to) are free. If a customer is from Florida, tickets are $80 (senior citizens still receive a 50% discount over the base ticket price regardless of their state of residence) Children under 14 from Georgia get an 18% discount over the based price. Senior citizens (age > 65) from Texas get an additional 7.5% discount after their senior citizen discount has been applied o Remember that a 7.5% discount can be computed in two ways; You can do amount=amount- amount*.075; (that is, subtract from amount 7.5% of amount) or amount=amount*.925; (make amount be 92.5% of its current value) Program must check if age is valid (a valid age is anything > 0), if not, an error message must be displayed. Optional: Program must continue executing or give an option to exit Program must accept state names ignoring capital letters (e.g. florida and Florida will be accepted) Output for prices/cost must be formatted using a $sign and two decimals You must use a String to store the visitor's state o Remember that to compare Strings, we cannot use ==. Instead, we use a String method called equals (this is one of the advantages of using object; they provide useful methods). Inputs cannot be hard coded or assignment will not be accepted When program is done, run the final version of your program using the following inputs
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