Data Structure

User Generated

mvmb23

Computer Science

Description

1 program assignment and the other one is write a paragraph about codes

Unformatted Attachment Preview

Use the fraction.py file located in the I:\kopp\outbox\CS 222 01\Programming Assignments\Chapter 01 folder. Complete the following: 1. Modify the Constructor for the Fraction class so that GCD is used to reduce fractions immediately. This means that the __add__ function no longer needs to reduce. 2. Implement the remaining simple arithmetic operators (__sub__, __mul__, and __truediv__). 3. Implement the remaining relational operators (__gt__, __ge__, __lt__, __le__, and __ne__). 4. Modify the constructor for the Fraction class so that it checks to make sure that the numerator and denominator are both integers. If either is not an integer the constructor should raise an exception. You must use the Fraction class created in class and located on the Instructor drive as shown above. If you do not do this, you will receive a grade of 0. Add the following comments to the beginning of the program. Name: Your Name Class and Section: CS 222 01 Assignment: Program Assignment 04 Due Date: See above Date Turned in: Program Description: You write a short description of what the program will do When you complete the program, do the following. 1. Turn in a printout of the source code 2. Create a folder with the following name: ProgramAssignment04 3. Copy your program to this folder 4. Copy the folder to your folder in the I:\kopp\inbox\CS 222 01 folder Research the __radd__ method. Explain in a paragraph how it differs from __add__. When is it used? Implement __radd__ in the Fraction class. This class can be found in the I:\kopp\outbox\CS 222 01\Program Assignments\Extra Credit folder. Research the __iadd__ method. Explain in a paragraph how it differs from __add__. When is it used? Implement __iadd__ in the Fraction class. Add the following comments to the beginning of the program. Name: Your Name Class and Section: CS 222 01 Assignment: Program Assignment 02 Extra Credit Due Date: See above Date Turned in: Program Description: You write a short description of what the program will do When you complete the program, do the following. 1. Create a folder with the following name: ProgramAssignment02EC 2. Copy your program and all appropriate files to this folder 3. Copy the folder to your folder in the I:\kopp\inbox\CS 222 01 folder
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

o...


Anonymous
Great! 10/10 would recommend using Studypool to help you study.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags