Question: coding language c++. files: hw3_calculator.cpp (function definitions) hw3_calculator.h (class/function prototypes) hw3.cpp (main) a typescript file demonstating program compilation, execution and testing You will implement the
coding language c++.
files:
hw3_calculator.cpp (function definitions)
hw3_calculator.h (class/function prototypes)
hw3.cpp (main)
a typescript file demonstating program compilation, execution and testing
You will implement the fraction class that was discussed in class and overload the following methods operators:
Addition (+): Adds 2 fractions and returns a fraction. Overload this operator as a member function.
Subtraction (): Subtracts a fraction from another fraction and returns a fraction. Overload this operator as a non-member function.
Division (/): Performs division on 2 fractions and returns a fraction. Overload this operator as a non-member function.
Multiplication (*): Multiplies 2 fractions and returns a fraction. Overload this operator as a member function.
In addition, you will implement a template for a queue with the following functions as a minimum:
-enqueue() that appends the latest item to the end of the queue.
-dequeue() that deletes the first item from the queue.
-peek() that returns the first item in the queue.
-empty() that checks whether the queue is empty or not.
Your calculator should keep prompting for new entries to calculate until the user decides to quit. After each calculation, you have to enqueue the result onto the queue. Once the user is done calculating, you will go through the queue and display all items in the queue one after the other.After displaying an item from the queue, it should be deleted from the queue. This means that after displaying the last item in the queue, the queue has to be empty.
TESTING YOUR CODE:
Run the following tests on your code: (3/4)+(7/4) = (10/4) or (5/2) (3/4)/(7/4) = (3/7) or (12/28) (3/4)-(7/4) = (-4/4) or (-1/1) or (4/-4) or (1/-1) (3/4)*(7/4) = (21/16)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
