Assume given the following class Date with the definitions of its constructors and member functions: class...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume given the following class Date with the definitions of its constructors and member functions: class Date ( public: c. Date(); Date(int mth, int dy, int yr); void Print() private: int month, day, year: // default date is 1/1/2000 // output the month, the day, and the year: mm/dd/yyyy }; a. Define two pointer variables ptr1 and ptr2 to hold the address of an object of the class Date. 2pts Write a statement to allocate a dynamic memory location (in the heap) to hold a Date object and to store its address in the pointer variable ptr1. 2 pts b. Write a statement to allocate a dynamic memory location (in the heap) to hold a Date object (initialized with the date 1/20/1990) and to store its address in the pointer variable ptr2. 2 pts d. Write a statement to output (print) the date in the memory location with the address in ptr2. 2 pts e. Write a statement to copy the date in object date to the memory location with the address in the pointer variable ptr1. 2 pts Assume given the following class Date with the definitions of its constructors and member functions: class Date ( public: c. Date(); Date(int mth, int dy, int yr); void Print() private: int month, day, year: // default date is 1/1/2000 // output the month, the day, and the year: mm/dd/yyyy }; a. Define two pointer variables ptr1 and ptr2 to hold the address of an object of the class Date. 2pts Write a statement to allocate a dynamic memory location (in the heap) to hold a Date object and to store its address in the pointer variable ptr1. 2 pts b. Write a statement to allocate a dynamic memory location (in the heap) to hold a Date object (initialized with the date 1/20/1990) and to store its address in the pointer variable ptr2. 2 pts d. Write a statement to output (print) the date in the memory location with the address in ptr2. 2 pts e. Write a statement to copy the date in object date to the memory location with the address in the pointer variable ptr1. 2 pts
Expert Answer:
Answer rating: 100% (QA)
a Define 2 pointer variables ptr1 and ptr2 to hold the ... View the full answer
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these algorithms questions
-
Problem 5: Suppose that the S&P 500 index has an expected return of 7% and a standard deviation of returns of 20%. The risk-free rate is 2%. a) What is the slope of the Capital Allocation Line (CAL)?...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
A corporation has three divisions, each responsible for sales to different geographical locations. Write a program using two classes which produce the sales and expenses data for each division, and...
-
Fill in each blank so that the resulting statement is true. I find (f g)(x) by replacing each occurrence of x in the equation for_______ with________ .
-
Consider the nozzle of Problem 16.17. What back pressure will be required to cause subsonic flow throughout the entire nozzle with M 1 at the throat?
-
Production of the manufactured concrete structures, thousand cub. meter, is indicated in the table below mentioned. What control measures can be implemented in Risks Assessment techniques to recover...
-
Consider the vector \(u\) that consists of 32 equally spaced samples of the function \(f(t) \approx \cos (4 \pi t)\) on the interval [0,1]. That is, \(u_{1}=f(0), u_{2}=\) \(f\left(\frac{1}{32}...
-
Fruity Juices, Inc. produces five different flavors of fruit juice: apple, cherry, pomegranate, orange, and pineapple. Each batch of product requires processing in three departments (blending,...
-
The Rolling Department of Jabari Steel Company had 5,300 tons in beginning work in process inventory (70% complete) on October 1. During October, 87,800 tons were completed. The ending work in...
-
Use the pie chart of a person's monthly income. a. Suppose the total monthly income is $5,800. Determine the amounts in each income category. b. Suppose the income from the secondary job was $1,225....
-
You are a marketing director Your boss wants to know how many stores carry your dry cereal Since you sell through food brokers you don't know the answer She wants the answer in two days What would...
-
Assuming time and money were not important concerns, would BPR projects benefit from additional time spent understanding the as-is system? Why or why not?
-
What are the main building blocks for the sequence diagram? How are they represented on the model?
-
What is meant by balancing the models?
-
Contrast the following sets of terms: state, behavior, class, object, action, and activity.
-
You are upgrading to better production equipment for your firms only product. The new equipment will allow you to make more of your product in the same amount of time. Thus, you forecast that total...
-
On January 1, 2022,Shot Co. acquired 75% of Good Inc Information on acquisition date: Good tidentifiable assets have a carrying amount of Php70,000 and fair value Php100,000. The difference is due to...
-
Write electron configurations for the following ions, and determine which have noble-gas configurations: (a) Cd2+ (b) p3- (c) Zr4+ (d) Ru3+ (e) As3- (f) Ag+
-
Write the result of each expression. Note that a variables value changes only if you reassign it using the = operator. double grade = 2.7; Math.round (grade); // grade grade = Math.round (grade); //...
-
Write a method called partition that accepts a list of integers and an integer value E as its parameter, and rearranges (partitions) the list so that all the elements with values less than E occur...
-
Consider the following method: For each of the following calls, indicate the value that is returned: a. mystery5(5, 7) b. mystery5(12, 9) c. mystery5(-7, 4) d. mystery5( 23, 48) e. mystery5(128,...
-
A container of an organic liquid a $25^{\circ} \mathrm{C}$ has a mass of $1100 \mathrm{~kg}$ and a volume of $0.94 \mathrm{~m}^{3}$. Find the liquid's weight, its density, and its specific gravity.
-
What is the pressure one mile $(1.6 \mathrm{~km})$ beneath the ocean's surface?
-
A vertical, cylindrical tank with a diameter of $10 \mathrm{~m}$ and a depth of $4 \mathrm{~m}$ is filled to the top with water at $25^{\circ} \mathrm{C}$. If the water is heated to $60^{\circ}...
Study smarter with the SolutionInn App