Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Jupyter Notebook, develop an object - oriented application that will perform calculations on rational numbers. While you are responsible for the application's final design,

Using Jupyter Notebook, develop an object-oriented application that will perform calculations on rational
numbers. While you are responsible for the application's final design, your application is expected to contain a
class called ratNum representing a rational number (ab), where a and b are both integers. You may assume that
b is positive for simplicity, and the application does not need to check this. However, if the value of b is zero, an
error message should be displayed to alert the user that it is not allowed. Within the class, you must write public
member function(s) to realize one of the following five tasks. The task to do should be determined by the
remainder obtained from dividing your team number by 5. For example, if your team number is SEVEN, 7%5=
2, and you should do Task 2) of this assignment.
2) The member function performs the multiplication with another rational number and returns the result as a
rational number. The result has to be in its simplest form, i.e., any common factors between the numerator
and the denominator should be canceled out. For example, if this rational number has a =12 and b =48, the
rational number to be multiplied has a =2 and b =16, the function should return 12/482/16=1/32, i.e. a
rational number of a =1 and b =32 in its simplest form.
It is required that the class and the implementation of its member functions should be built as a separate
module to be imported by the application.
Your application is expected to provide a text menu as a user interface. Through the interface, the user can
repeatedly enter rational numbers (by providing the values of a and b) and do calculations of your task for
different rational numbers. The user can also choose to end the application through the interface.
Should you want to get a credit grade, you should design the application such that when a user wants to start
it, he needs to login with a username first, which will be checked with a file that stores username-password
pairs. If the username is new, the application will ask for a password from the user and store it into that file.
If the username can be found in that file, the application will ask for a password from the user, and the program will start only when the password is correct. The application will end if the user fails to provide the correct
password in three consecutive trials.
Should you want to get a distinction grade, you should add a function to the class that can compute a nonzero rational number to the power of n, where n is a positive integer, zero, or negative integer. (If the rational
number is zero, the function should show an error message and do nothing.) The result must be a rational
number in its simplest form. For example, if the rational number has a=12 and b=48, and n =-2, the function
should return a rational number of a=16 and b=1.You should
also consider computing rational number to the power of another rational number.
image text in transcribed

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

Step: 3

blur-text-image

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

19. How does cocaine infl uence dopamine synapses?

Answered: 1 week ago

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago