Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Specifications This is your first ever program using object oriented methodology. and this assignment you will need to instantiate (create) object(s) and invoke their

Program Specifications

This is your first ever program using object oriented methodology. and this assignment you will need to instantiate (create) object(s) and invoke their member functions to perform different tasks. The program is to keep track of customer orders and to create reports as needed.

At minimum you will need several objects to be instantiated throughout the program such as:

An OrderProcessor object

Order objects (stored in an array)

Let's get to class design now.

Class Design

class Order: represents customer order information.

Private member data:

customer name

product name

unit price

quantity

order date (11/dd/2019)dd is 2-digit day

Public constructors: (must use member initializer syntax)

Default constructor: set unit price to 0.0, quantity to 0, order date to "11/01/2019".

Non-default constructor:take customer name, product name, unit price, quantity and day (integer) as parameters. Here you must initialize the order data to "11/dd/2019".

Public destructor: output "Order dtor called ..."

Public member functions: (must declare const function if they do not modify member data)

Accessor/mutator for all member data. For set_order_date mutator it must take an integer as day (dd) and set order date to "11/dd/2019" similar to how you do it in the non-default constructor.

class OrderProcessor: maintain a list of Order objects (array of Order objects) and the public interface to update/modify the Orders.

Private member data:

Company name

Company web site(www.xyz.comfor example)

An array of 32 Order objects (namely order_list)

Order count (the actual number of Orders in the system)

Public constructors: (must use member initializer syntax)

Default constructor: set order count to 0.

Non-default constructor: take a string for company name and a string for company web site (must set order count to 0 similar to default constructor).

Public destructor: output "OrderProcessor dtor called ... "

Public member functions: (must declare const function if they do not modify member data)

Accessor/mutator for company name, company web site, and order count

Init: Use a for loop similar to the LoadVehicle function in assignment 3 to randomly generate 16 Orders (array will be half full) as follows:

Randomly generate a number 1-5: for each randomly generated number you can assign a Product name (such as iPhone Xr, Samsung 52-inch SmartTV, Dell Inspiron 15-inch Laptop, ...) and its associated price per unit (you can make up the unit price value however appropriate).

Randomly generate a Product quantity (1-10) for the order .

Randomly generate an order day (1-30 for the month of November).

Now call the mutators in Order object to properly initialize the current Order element in the Order array: customer name (taken from a local string array of 16 names declared inside the Init function), Product name, unit price, quantity, order date (of November, 2019). An example of this setting is: order_list[i].set_product ("iPhone 7");

NOTE: don't forget to update the order count member to 16.

AddOrder: ask user input for a new Order with all needed Order info and add it to the end of the array. Must check for overflow first and deny the order as needed.

ReportOrderDetails: list all orders with a nice format as follows.

Company:Web-site:

CustomerProductQuantityUnit PriceTotal costOrder date

James WestiPhone Xs10750.007500.0011/02/2019

Cynthia HawkinsRefrigerator11235.991235.9911/15/2019

Implementation/Coding Requirements

Must follow Google style for naming convention in class declarations and definitions (member data variables, member function names etc ...).

Must define constructors/destructor/member functions separately from class declarations.

Main Program

Instantiate a non-default OrderProcessor object. Invoke the following object's member functions:

Init

ReportOrderDetails

Use a loop to add three more Orders

ReportOrderDetails

Testing

Run your program 2 times. Verify the report is correct each time especially after you add three more orders to the OrderProcessor.

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

Students also viewed these Programming questions