Ask Computer Engineering Expert

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 prepare 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 ex,


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 ex, $12.25.

Here is an ex:

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 exs 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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9105904

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As