Complete the following tasks: a. Create a class named Order that performs order processing of a single

Question:

Complete the following tasks:

a. Create a class named Order that performs order processing of a single item. The class has four fields: customer name, customer number, quantity ordered, and unit price. Include set and get methods for each field. The set methods prompt the user for values for each field. This class also needs a computePrice() method to compute the total price (quantity multiplied by unit price) and a method to display the field values.

b. Create a subclass named ShippedOrder that overrides computePrice() by adding a shipping and handling charge of $4.00.

c. Create the logic for an application that instantiates an object of each of these two classes. Prompt the user for data for the Order object and display the results; then prompt the user for data for the ShippedOrder object and display the results.

d. Create the logic for an application that continuously prompts for order information until the user enters ZZZ for the customer name or 10 orders have been taken, whichever comes first. Ask the user whether each order will be shipped, and create an Order or a ShippedOrder appropriately. Store each order in an array element. When the user finishes entering data, display all the order information taken as well as the total price that was computed for each order.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: