Instructions
• The five parts of the Software Development Process as presented by Cay Horstmann [1] will be used as the basis for this lab exercise.
1) Understand the problem
2) Develop and Describe an Algorithm
3) Test Algorithm with Simple Inputs
4) Translate the Algorithm into Java
5) Compile and Test Your Program
• Also refer to your textbook by Joyce Farrell [2] for help with pseucode, flowcharts, UML class diagrams.
What is the problem to solve for this exercise?
• A movie theatre company would like a program that calculates the cost of an admission ticket, based on the age of the customer. (Ticket prices taken after [3], age ranges taken after [4]). The user will enter the age, then program output will be the price for a single ticket.
o newborns, infants, toddlers zero (inclusive) to 2 years (exclusive) free admission
o child, youth 2 to 18 years (both inclusive) $15.00
o adult 19 (inclusive) to 65 years (exclusive) $20.00
o senior 65 years or older (inclusive) $12.00
o Any age entered that is less than zero, or greater than or equal to 130 should result in the program outputting an “invalid age entered” error message instead of a price.
• Ages are entered as non-decimal numbers.
• Output in the Java program should be via printf, with %f formatting output to 2 decimal places.
• Your full student name also needs to be part of the output.
• Some starter code is provided, you must use the starter code and cannot make changes to the structure of the provided classes, you need to complete the missing logic in the indicated methods ticketPrice and main.
Part 1 Understand the Problem
• Review the word problem, as well as look at the starter code provided.
• Outline how the main logic would flow from inputs, to processing, to output.
• Use boolean expressions to plan the process of ticket pricing above into program logic, e.g.
Example: age < 0 OR age >= 130 report error
and so on…
Part 2a Pseudocode
• Create a detailed UML Class diagram that documents the provided class(s).
• Write pseudocode for the ticketPrice method
• Write pseucode for the main method
• Consider: Can a nested if structure be used to reduce the number of comparisons? See lecture notes week 9.
Reminder: Please review the lecture notes for UML Class diagrams as well as your Joyce Farrell textbook [2].
• In our course typically, we will have a class with only method main, as this is a static method it should be underlined.
• Local scope variables inside method main are not to be documented in the UML class diagram in the second row.
• Expanding on that, we never document variables that are local scope, i.e. declared within constructors or methods.
• The only variables that appear in a UML Class diagram, in the second row, are class-level variables declared at a class level.
• The only local-scope variables that appear in a UML class diagram, at all, are the parameters for constructors, and methods, but these are in-lined within each constructor’s or method’s line within the third row.
E.g.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of