Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this 2 questions and the answers have to be in Python 3.x. Please help. Thank you! 7. Provide a class for
I need help with this 2 questions and the answers have to be in Python 3.x. Please help. Thank you!
7. Provide a class for authoring a simple letter. In the constructor, supply the names of the sender and the recipient: der-init-(self, letterFrom, etterTo) Supply a method def addLine(self, line) to add a line of text to the body of the letter. Supply a method def getText(self) that returns the entire text of the letter. The text has the form: Dear recipient name: blank line first line of the body second line of the body last line of the body blank line Sincerely, blank line sender name Also supply a driver program that prints the following letter: Dear John: 1 I am sorry we must part. I wish you all the best. Sincerely, Mary Construct an object of the Letter class and call addLine twice. 2. Design a class called Color. The fields of the class are three decimals for Red, Green, and Blue components in the range 0 to 1, inclusive (0 indicates Black and 1 indi- cates White). Add checks to ensure that the values are always in the given range Provide addition and subtraction operators for the color class. Include saturation in the addition and subtraction: if any component goes less than 0 or greater than 1, assign them 0 or 1, respectivelyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started