Question: Practical Work Using Jupyter Notebook or other Python development platform, develop an object - oriented application that processes fractions. While you are responsible for the
Practical Work
Using Jupyter Notebook or other Python development platform, develop an objectoriented application that processes fractions. While you are responsible for the application's final design, your application is expected to contain a class called fraction, which represents the general format of a mixed fraction, ie i fracnd where i is an optional integer part, n is the numerator and d the denominator. You can assume that all numbers i n and d are integers, and you do not need to check for this. Note that d must be positive. If d is zero, the number is undefined. If i is zero, then n may be negative, zero, or positive. However, if i is nonzero positive or negative n must be nonnegative, and. If n is zero, the fractional part does not exist and it reduces to the simple integer i The general output format will be ind Within the class, you must write public member functions to realize one of the following five tasks. The task to do should be determined by a hash function, boldsymbolhgroupNo sid sid sid taking inputs from the group number a number of two digits and the numeric digits of the sid of the students in the group. The hash function boldsymbolh will be provided after the groups are formed.
Tasks
The member function performs the addition with another fraction and returns the result as a fraction. This is realized by implementing adc inside the class. The result need NOT be in its simplest form eg need not be expressed as
The member function performs a subtraction with another fraction and returns the result as a fraction. This is realized by implementing sub inside the class. The result need NOT be in its simplest form eg need not be expressed as
The member function performs a multiplication with another fraction and returns the result as a fraction. This is realized by implementing mathrmmu
inside the class. The result has to be in its simplest form, ie any common factors between the numerator and the denominator should be canceled out. For example, if this fraction has n and d the fraction to be multiplied has n and d the method should return times ie a fraction of n and d in its simplest form as is the highest common factor HCF of and
The member function performs a division with another fraction and returns the result as a fraction. This is realized by implementing truediv inside the class. The result has to be in its simplest form, ie any common factors between the numerator and the denominator should be canceled out. For example, if this fraction has n and d the fraction to be divided has n and d the method should return div ie a fraction of n and d in its simplest form as is the highest common factor HCF of and It can be assumed that the divisor is not zero.
The member function @ performs a comparison with another fraction. It returns the integer value if the other fraction is the same in value. It returns the integer value if the other fraction is bigger ie this fraction is smaller It returns the integer value if the other fraction is smaller ie this fraction is bigger This is realized by implementing matmul inside the class.
Some sample program lines and execution results for reference only:
f fraction f fraction
f fraction f fraction
f fraction fraction
f fraction
printformatfff f print @ formatfff@f
printformatfff f print @ formatfff@f
printformatfff f print @ formatfff@f
printformatfff f print @ formatfff@f
f fraction
p
printformatfpf p
printformatfff f
printformatfff f
@
@
@
@
@
@
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
