hey yall , im suppose to do this assignment but i haven't studied classes yet (couldn't attend online class and forgot to watch the videos), and there`s this time limited assignment that i dont know how to write it with classes
assignment :
Create a class called rational that performs computational operations on fractional numbers. Then write a program that uses this class.
the functions of the class (in the class) are:
1-Print fractional numbers as a fraction form like == > 132\240
2-Print fractional numbers in decimal form like == > 0.55
Your program should include 4 non-class functions as follows:
1-sum of fraction
2-subtract of two fraction
3-Multiply two fractional numbers
4-Divide two fractions
[i can write these but i dont know how to relate them to a class or how the class works]
input :
The input consists of 4 lines, in each line, numerator and denominator a fraction is given.
-100 <= num,den <= 100
output :
252/5000
The output will be a fraction that will be obtained from ((multiplied by (sum of the first and second fractions)) and (third fraction) divided by (fourth fraction) minus (first fraction)
they need to be printed in decimal and fraction form
If the denominator of the fraction is zero, type "impossible" instead of decimal format. ==>[ 0\0 and in the next line impossible ]
first input :
1 2
2 3
3 4
5 6
first output :
132\240
0.55
second input :
1 0
2 3
3 4
5 6
second output :
0\0
impossible
thank you in advance i know its a lot to ask but i wouldn't ask u guys if i could've done it by myself , it might take days for me [its a timed assignment i have 1 day left] but its nothing for u guys : )
those 4 are out of class , the class has 2 function of its own to print in 2 different form ;
also i dont know how to put them all [class and that 4 function] in main
couldn't attend online class and forgot to watch the videos
Time to watch those videos. :) Programming knowledge is cumulative: you need to learn about classes our you'll have more and more trouble going forward.
yeah i know XD but it had time to write it and watching the videos would've take more .
dsnt matter anymore since the time ended imma go watch the videos now XD