Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

On c++ i need to be 3 file main.cpp function.cpp function.hpp Plz i need yo see the result Thx Description: Define a class called fraction

On c++ i need to be 3 file main.cpp function.cpp function.hpp
Plz i need yo see the result
Thx image text in transcribed
image text in transcribed
image text in transcribed
Description: Define a class called fraction that will hold a numerator, denominator, and the decimal representation of the fraction. The class should define a default constructor that will set the numerator and the denominator to 1 and the correct decimal representation. There should be another constructor that will accept the numerator and denominator as parameters. To set the values for the constructors, use an initialization section. Write overloaded fraction operators to add, subtract, multiple, and divide fractions. Write an overloaded cout operator that will print out the fraction as xly. Write an overloaded cin function that will ask for a numerator and denominator of a fraction. You will also write a function that will calculate the decimal equivalent of the fraction. You should also have a function that will reduce the fraction and return the result. The original fraction should still be saved. For example, if the fraction is 6/10, this function should return 3/5, but if the original fraction should still be stored as 6/10. In the main function, you are going to write code that will display the following menu 1. Add fractions 2. Subtract fractions 3. Multiple fractions 4. Divide fractions 5. Reduce a fraction 6. Show the decimal equivalent of a fraction 7. Exit the program For the first 4 cases, the program should ask for the 2 fractions. For 4 -6, the program should ask for 1 fraction

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_2

Step: 3

blur-text-image_3

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions