Question
Write a modularized program to generate a fraction multiplication table using dynamic memory allocation. Use the fraction class from previous labs. Modify class fraction to
Write a modularized program to generate a fraction multiplication table using dynamic memory allocation. Use the fraction class from previous labs. Modify class fraction to keep track of number of object currently in memory Let the user input a denominator, and then generate all combinations of two such fractions that are between 0 and 1, and multiply them together. Declare a pointer to two dimensional array of pointers. Dynamically allocate two dimensional array of pointers based on the denominator entered by a user. Create fractions dynamically. Only positive fractions. No need to reduce. Well-formatted output is required ( right align all numerical values) Heres an example of the output if the denominator is 7:
private: int numerator; int denominator; int whole public:
Fraction(); Fraction(int n, int d); //Fraction(int nu, int de, int w); Fraction(const Fraction &obj);
~Fraction();
void setdenominator(int); void setwhole(int); void setnumerator(int); void setFraction1(int w, int nu, int de); void setFraction(int nu, int de);
inline int getnumerator() const; inline int getdenominator() const; inline int getwhole() const; void show()const;
you can ignore whole part;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started