C++Classes & Inheritance For this program we’ll be writing a simple class hierarchy and taking a

C++Classes & Inheritance For this program we'll be writing a simple class hierarchy and taking advantage of inheritance polymorphism. Pete's Pizza has branched out and now has a storefront location. The menu is still limited: pizza and sandwiches, and a few sides. As his store is at 2020 20th street, and he sold his first pizza 20 years ago, he's running a 20-themed promotion:

1 order in 20 (randomly selected) gets a 20% discount. This applies to any menu item. You have a data file containing a day's orders. You must answer the questions: How many items of each type were sold? What were the total sales for each type? How many items were discounted? What was the total amount of all discounts given? For this program we'll use a class hierarchy. The parent class is called MenuItem. Each MenuItem has: • A name (string, private), with a getter and setter. • A description, also a private string, with a getter and setter. • A price (float, protected) with a getter. (Child classes will set their own prices.) • A default constructor that sets the calorie count and price to 0. (The string constructor will set string values to the empty string.) This class has two child classes, which have the following properties in addition to inherited properties: Pizza: • Size (small/medium/large/family. Use an enumerated type for this.) Size varies by price: $7 for small, $8 for medium, $10 for large, $12 for family size. Setting the size should set the price. • Crust type (thin/thick/stuffed, another enumerated type). Stuffed-crust pizzas cost $1 more regardless of size. • Up to 5 modifications (extra cheese, no onion, etc). These do not affect the price. • A constructor that sets default parameters to small size, thin crust. • ReadData(istream&). This method reads in data in the following order: The name, description, size, crust type, calorie count, up to 5 modifications (modifications end with '*', whether there are 5 or none). Strings may contain spaces, and each is on its own line; use the getline() method to read these strings. This method should set the price of the pizza based on the options that were read in. This method returns true if the attempt to read the data was successful, false otherwise. Sandwich: • Side item (chips, slaw, fries), a string. • All sandwiches cost $8. • A ReadData(istream&) method that reads the name, description, calorie count, and side item. It also returns true if the attempt to read was successful, false otherwise. Finally, you will need a function to apply the discount for selected items. Implement this prototype: float DiscountedPrice(const MenuItem& item); // pre: item has data set. // post: returns discounted price IF discount applies (20% chance). Otherwise returns original price. // I/O: None. // Interaction with user: None. // Error handling: None.

// Algorithm: If rand() % 100

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now
 

Looking for a Similar Assignment? Let us take care of your classwork while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Use Code FREE15