Обьясните алгоритм решение етих задач
Create a class called Rational for performing arithmetic with fractions. Write a
program to test your class. Use integer variables to represent the private data of the class –
the numerator and the denominator. Provide a __init__() method that enables an object of
this class to be initialized when it’s declared. The __init__() should contain default
parameter values in case no initializers are provided and should store the fraction in
reduced form. For example, the fraction 2/4 would be stored in the object as 1 in the
numerator and 2 in the denominator. Provide public methods that perform each of the
following tasks:
printing Rational numbers in the form a/b, where a is the numerator and b is the
denominator.
printing Rational numbers in floating-point format.
2. Create a class Rectangle with attributes length and width, each of which defaults to
1. Provide methods that calculate the perimeter and the area of the rectangle. Also, provide
setter and getter for the length and width attributes. The setter should verify that length and
width are each floating-point numbers larger than 0.0 and less than 20.0.