Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++: Assuming the following class definition: class Order { private: int order_month; public: static const int DEFAULT_MONTH; public: Order ( ) ; int get_month (

c++:

Assuming the following class definition:

class Order { private: int order_month; public: static const int DEFAULT_MONTH; public: Order ( ) ; int get_month ( ) const; };
const int Order::DEFAULT_MONTH = 1; Order::Order ( ) : order_month ( Order::DEFAULT_MONTH ) { } int Order::get_month ( ) const { return order_month; }

1. Declare a const pointer to an Order object namely order_list and initialize it with a dynamically allocated array of 2048 Order objects.

2. What are the array elements' data type and their "values" after the code in question 1 is executed? Your answer must be as specific as possible.

3. Assuming the array has been populated with meaningful data now. Use a regular for loop (no C++ enhanced for loop is allowed) to go thru the entire the array and count the number of orders in May ( 5 is May's integer representation). You must use a separate pointer variable and increment operator to iterate through array's elements. Array notation or (pointer + i) syntax is not allowed.

4. Finally de-allocate the array memory.

Do not write the entire program. You only need to write a piece of code.

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

2. (1 point) Given AABC, tan A b b

Answered: 1 week ago