You have been hired to create the point of sale


Fast Food Point of Sale (POS) System

You have been hired to create the point of sale (POS) system for a new fast food restaurant opening on Hillsborough St. The restaurant has a limited menu -- Hamburgers, Chicken Sandwiches, and Fish Sandwiches. Each may be purchased separately or as part of a Combo that includes fries and a drink. Combos may be Supersized to include a larger order of fries and an extra large drink. The table below gives the price for each type of order:

Meal Sandwich Combo Supersize
Hamburger $ 2.50 $ 4.50 $ 5.00
Chicken Sandwich $ 3.00 $ 5.00 $ 5.50
Fish Sandwich $ 2.75 $ 4.75 $ 5.25


Requirements

For this project, you will write a program named FastFoodPOS.
It must display a header that lists the name of the application -- you may name the application as you like -- and provides instructions about using the program. For example,


Welcome to Wolfpack Fast Food POS!
When prompted, please enter the number of meals to be purchased, the type
of each meal -- H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich) -- and
whether or not it is a Combo. If it is a Combo, you will be prompted as to whether
or not it should be Supersize. The total cost of the meals will then be displayed.


The user should be prompted for the following input values:

The number of meals to purchase. For each meal the user should be prompted for
The meal type (H, C, F). Both uppercase and lowercase characters should be accepted.
If the meal is a Combo (y, n). A yes answer should be assumed if the user enters anything that starts with y or Y. Any other response is considered to be a no answer. If the meal is a Combo, the user should be prompted for
If the Combo should be Supersize (y, n). A yes answer should be assumed if the user enters anything that starts with y or Y. Any other response is considered to be a no answer. 

The program should then output the total cost of the meals formatted as a monetary amount, for example, $12.25.

Here is an example:

C;csc116> java FastFoodPOS
Welcome to Wolfpack Fast Food POS!
When prompted, please enter the number of meals to be purchased, the type
of each meal -- H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich) -- and
whether or not it is a Combo. If it is a Combo, you will be prompted as to whether
or not it should be Supersize. The total cost of the meals will then be displayed.

Number of meals to purchase: 3

H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: H
Combo? (y/n): NO

H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: f
Combo? (y/n): y
Supersize? (y/n): yazoo

H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: C
Combo? (y/n): y
Supersize? (y/n): x

Total: $12.75


Error Handling

If the user enters anything other than a non-negative integer for the number of meals or an invalid meal type, the program should print "Invalid input, try again." and reprompt.

Here are some examples of handling invalid input:

C:csc116> java FastFoodPOS
Welcome to Wolfpack Fast Food POS!
When prompted, please enter the number of meals to be purchased, the type
of each meal -- H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich) -- and
whether or not it is a Combo. If it is a Combo, you will be prompted as to whether
or not it should be Supersize. The total cost of the meals will then be displayed.

Number of meals to purchase: -5
Invalid input, try again.
Number of meals to purchase: i
Invalid input, try again.
Number of meals to purchase: 2

H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: F
Combo? (y/n): y
Supersize? (y/n): n

H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: X
Invalid input, try again.
H (Hamburger), C (Chicken Sandwich), or F (Fish Sandwich)?: h

Design
The program must contain and use the completed version of the method below. You are free to define and use additional methods, if you like -- be sure to provide Javadoc for them. Replace the comments below with appropriate Javadoc. See pp. 1124 - 1127 of the textbook for how to include a Javadoc @throws tag to document the IllegalArgumentException.
NOTE: The inputs that will cause the exceptions should not occur if you have written your code that calls this method correctly. You must add the checking to this method anyway so that it will function properly if called by a method from outside your class (e.g. your test class).


//Returns the cost of the meal in cents.
//Throws an IllegalArgumentException if the mealType is not 
//'h','H','c','C','f', or 'F' OR if isCombo is false and isSupersize is true.
public static int getMealCost(char mealType, boolean isCombo, boolean isSupersize) {

}


Implementation
In order to avoid roundoff error, you must do all calculations using whole numbers of cents and int variables. It's fine to use a double value in combination with a printf statement which rounds it to 2 decimal places for your output. Here is an easy way to do this:

double total = totalInCents/100.; System.out.printf(" Total: $%.2fn", total); 


Testing

You will also submit a suite of black box testcases and a white box test program as described below:

Complete the provided Black Box Test Plan (BlackBoxTestPlan.docx, BlackBoxTestPlan.pdf). Your 9 test cases must be non-redundant, repeatable, and specific! Non-redundant means that each test case should correspond to a unique error condition or a unique combination of valid inputs. Be sure to consider equivalence classes and boundary values when designing your test cases. Your Black Box Test Plan should contain the results of running your test cases on your program.
You can submit as a word document or you can fill in a printed copy and scan it to submit (call the scanned file BlackBoxTestPlan).
Five of your black box test cases will be randomly selected by the TA and run on your program to ensure that they pass.
Complete the provided White Box Test program (FastFoodPOSTest.java) by adding the specified 16 test cases for valid values. Be sure to consider basic path testing when designing your test cases, each test case should test a unique combination a valid inputs to the method. The white box program also contains two test cases for invalid values. Do not change these. You do not need to add any test cases for invalid values.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: You have been hired to create the point of sale
Reference No:- TGS0105904

Expected delivery within 24 Hours