Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is java A program is needed to take online orders for pizza. The Redbird Pizza Shop sells 3 sizes of pizzas: small, medium,

This program is java

A program is needed to take online orders for pizza. The Redbird Pizza Shop sells 3 sizes of pizzas: small, medium, and large. The following toppings can be added: extra cheese, sausage, pepperoni, and mushroom. Each additional topping costs $2.00 each. The prices per size are as follows:

Size Price

Small $10.00

Medium $12.00

Large $16.00

The program that is needed for the online ordering system will allow the customer to order pizzas of each size with as many toppings as they wish. The customer can order more than one pizza, but all must be the same size and have the same toppings. When completing an order, an itemized bill is to be displayed. This bill should include a 9.75% tax and $1.85 additional charge for delivery. Delivery charge will not be taxed.

Use the example runs given below for formatting and prompts. Your program should look the same.

The beginning of the program should display a welcome and a menu with prices and choices. Follow the format given in the example run below.

The customer should first be asked what size of pizza they would like. This value should be validated for S, M, or L (upper or lowercase) has been issued. If invalid, the user should get an error message and be asked to enter the value again.

Next ask the customer for how many pizzas they would like to order.

Give a menu for the customer to choose what toppings should be added to the pizza. They should be allow to add any or all of the choices available. The choice option should continue until the 5 for Quit is chosen. The value entered should be validated with an error message given for an invalid choice.

Once the customer has made their pizza choice, the total of the bill should be displayed and the customer asked whether they want to complete the order.

If the customer chooses to not complete the order, just display the thank you message. If they do choose to complete the order, ask for the customer information. You should use the AddressBook class from the previous program to store this information and format the output.

If choosing the extra credit option as described below, you would next ask the customer for their credit card number. Leave all references of the credit card out of the program if you do not choose to do the extra credit. Do NOT attempt the extra credit until you have the rest of the program working correctly.

Once all information has been added, display a receipt with the subtotal (cost of pizza), tax, delivery charge, and total. After the receipt display the customer information, credit card information (optional), and the thank you message.

You can implement the option of asking the customer for a credit card number to pay for their order. This credit card number should be validated with the following rules. If invalid, an error message should be displayed and the user prompted to enter the number again.

Rules for determining a valid credit card.

Card Type

Card Number Prefix

Number of Digits (Length)

VA

4

13 or 16

MC

51, 52, 53, 54 or 55

16

AX

37

15

VA Visa

MC Master Card

AX American Express

The credit card validation should be implemented in a CreditCard class that has no instance variables. It should have three static methods as illustrated in the following class diagram.

CreditCard

+ isCardValid(String):Boolean

+ getCardType(String):String

+ maskCardNumber(String):String

isCardValid

Validates whether a card is valid following the rules above checking the card type, card number prefix, and number of digits.

getCardType

Determines whether it is a Visa, Master Card, or American Express

maskCardNumber

Formats the credit number for printing on the receipt replacing all but the last 4 digits with xs.

Example run (items in bold entered by user)

Welcome to the Redbird Pizza Shop

Sizes: Small Medium Large

Prices: $10.00 $12.00 $16.00

Special toppings $2.00 each:

extra cheese, sausage, pepperoni, mushroom

All pizzas must be the same size and have the same toppings.

What size of pizza would you like to order (S, M, or L)? m

How many pizzas would you like? 2

What toppings would you like to add?

1. Extra cheese

2. Sausage

3. Pepperoni

4. Mushroom

5. Quit

Enter your choice: 2

Enter your next choice: 4

Enter your next choice: 5

Your total will be: $36.97

Would you like to complete this order? Y

Please enter customer information:

Enter first name: Cathy

Enter last name: Holbrook

Enter street address: 123 Main St

Enter city: Normal

Enter state: IL

Enter zip code: 61761

Enter phone number in form 9999999999

3095551234

Please enter your Credit Card Number: 4111111111111111

Order Summary

Pizza Size: M

Toppings:

Sausage

Mushroom

Number pizzas ordered: 2

Subtotal: $32.00

Tax: $ 3.12

Delivery Charge: $ 1.85

Total: $36.97

Cathy Holbrook

123 Main St

Normal, IL 61761

(309)555-1234

Credit Card: Visa xxxxxxxxxxxx1111

Thank you, please come again.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago