Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Assuming the following class definition: class Order { private: float purchase_price_; public: Order ( ) ; float get_purchase_price ( ) const; } ; Order::Order

C++

Assuming the following class definition: class Order { private: float purchase_price_; public: Order ( ) ; float get_purchase_price ( ) const; } ; Order::Order ( ) : purchase_price_ (0.0) { } int Order::get_purchase_price ( ) const { return purchase_price_; }

1. Declare a pointer to an Order object namely p_order_list and properly initialize it at declaration

2. Dynamically allocate an array of 1024 Order objects and assign it to p_order_list. NOTE: this is a dynamic array of Order objects, not an array of pointers to Order objects 3. Write a loop to go thru the entire the array and count the number of Order objects that have purchase price over 1,000 (one thousand). You must use pointer syntax (not array syntax [ ]) by declaring an additional p_order pointer. Also pointer syntax such as (p_order + i) is not allowed meaning you must increment the pointer to move from one array element to another.

4. Finally de-allocate the array memory and reset p_order_list to NULL.

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

Which county region has the smallest percentage of respondents?

Answered: 1 week ago