support@chatgptassignment.com
Electronic submission: You must submit a single .zip file containing only the source file(s). Use a utility that produces .zip files (Windows/Mac compression utility), and include only source files (.cpp, .h) and text files (.txt). ! Objectives ▪ To create a class that uses operator overloading. !P roject setup Use your IDE to create the project hw05. !R efer to the appropriate “how to” tutorial notes available on the course website, for instructions on how to create a project and manage its files. ! Language features used ▪ classes, operator overloading !P roblem Description In this programming assignment you are to create a class Fraction, to store and manipulate fractions. You will overload some operators and test the class out. ! Implementation requirements (1) Create the class Fraction to store a fraction as two distinct values; one for the numerator and one for the denominator. This time around the fields should be integer values. (2) Add the necessary ctor(s) and accessor methods. (3) Add a toString() method per usual. (4) Add a private method int gcd() const, to return the greatest common divisor. The algorithm based on our old friend Euclid is given below, so just copy paste or type into your own class. (5) Add a method that returns the value of the fraction as a decimal value. (6) Add a method that reduces the fraction to its simplest form, e.g. 2/4 becomes 1/2. Use the gcd() method to help you out. (7) Add all the relational operators (==, !=, <, <=, >, >=). (8) Add the four arithmetic operators (+, -, *, /). (9) Add the two operators (<<, >>) as functions. The output operator simply displays the fraction as n/d and the input operator reads the numerator and then denominator from the keyboard. See the screenshot below. (10) Test the class in the driver using the sample output given below as a guideline. ! Administrative Requirements As you write your programs from here on out, documentation will be desirable and an essential part of your code. Add the following section to each of your programs to identify relevant information to anyone reading your code. The sample below is what I used for main.cpp, so make the appropriate changes to reflect your current/accurate information. This is just a sample, so feel free to add to it if you want, but do not remove anything. ! /* File: main.cpp * Name: Socratis Tornaritis * Revised: 8/16/2014 * Course: CS240 – Introduction to Computing III – Fall 14 * * Desc: This program