Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I posted this question and some guy thought this code is about a zoo I'm posting it again hoping I'll get a different result solve

I posted this question and some guy thought this code is about a zoo

I'm posting it again hoping I'll get a different result

solve this in C++

take your time, I care about quality

separate the headers from the cpp files

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The following diagram illustrates the classes you will implement in this lab and their relationships. \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ JD } \\ \hline() JD_Amount : float \\ () Interest_rate: int \\ \hline(+) parameterized Constructor \\ (+) setters \\ (+) getters \\ (+) virtual destructor \\ (+) pure virtual getTotal(Account ):float \\ (+) virtual print_details : void \\ \hline \end{tabular} \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ Dollar } \\ \hline() Dollar_Amount : float \\ () exchange_rate : float \\ \hline(+) parameterized Constructor \\ (+) setters \\ (+) getters \\ (+) virtual destructor \\ (+) pure virtual getTotal(Account ):float \\ (+) virtual print_details : void \\ \hline \end{tabular} Ex 1. Account Class Implement Class Account as described in the UML diagram above. Ex 2. JD Class Implement Class JD as described in the UML diagram above. Notice that: 1-GetTotal function will multiply the JD_Amount by the interest_rate as the equation (JD_Amount * (1.0 +Interest_rate) ) 2- Parameterized constructor that receives all data members including data members in the base class. 3- in print you have to print all details of object. 4- override the destructor. Ex 3. Dollar class Implement Class Dollar as described in the UML diagram above. Notice that: 1-GetTotal function will devide the dollar_Amount by the exchange_rate to convert it to JD as the equation (dollar_Amount / Exchange_rate) 2- Parameterized constructor that receives all data members including data members in the base class. 3- in print you must print all details of object. 4- override the destructor. 4. Driver Implement a driver program to test your code. 1- Create two objects, one of type JD and another of type Dollar including the information of account (enter any values). 2- Create array of pointers of type Account of size 2. The first pointer points to the first object and the second pointer points to the second object. 3- Print all of the information of each object using the print function using loop 4- Define a function that recives the an array of Accounts and the size that calculate the total of the two objects using the getTotal for each object and loop then print the final result. 5- Call the function defined in the previous point. Lab Objectives. - Practice using polymorphism. - Using virtual and pure virtual function

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions