PLEASE USE PYTHON PROGRAMMING   Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which takes the parameters x and y (these should all be numbers). Write a method called add which returns the sum of the attributes x and y. Write a class method called multiply, which takes a single number parameter aand returns the product of a and MULTIPLIER. Write a static method called subtract, which takes two number parameters, b and c, and returns b - c. Write a method called value which returns a tuple containing the values of x and y. Make this method into a property, and write a setter and a deleter for manipulating the values of x and y.   class Numbers:     # TODO: create a class attribute called MULTIPLIER          def __init__(self, x, y):         self.x = x         self.y = y     def add(self):         # TODO: return x + y     def multiply(self, a):         # TODO: return the attribute MULTIPLIER * by a.     @staticmethod     def subtract(b, c):         # TODO:      # TODO: Make this a property     def value(self):         return self.x, self.y     # TODO: Create a setter and a deleter for value. # test the class. num = Numbers(5,6) print(num.add()) print(num.multiply(2)) print(num.subtract(4, 4))

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

PLEASE USE PYTHON PROGRAMMING

 

Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which takes the parameters x and y (these should all be numbers).

  1. Write a method called add which returns the sum of the attributes x and y.
  2. Write a class method called multiply, which takes a single number parameter aand returns the product of a and MULTIPLIER.
  3. Write a static method called subtract, which takes two number parameters, b and c, and returns b - c.
  4. Write a method called value which returns a tuple containing the values of x and y. Make this method into a property, and write a setter and a deleter for manipulating the values of x and y.

 

class Numbers:
    # TODO: create a class attribute called MULTIPLIER
    
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def add(self):
        # TODO: return x + y

    def multiply(self, a):
        # TODO: return the attribute MULTIPLIER * by a.

    @staticmethod
    def subtract(b, c):
        # TODO: 

    # TODO: Make this a property
    def value(self):
        return self.x, self.y

    # TODO: Create a setter and a deleter for value.

# test the class.
num = Numbers(5,6)
print(num.add())
print(num.multiply(2))
print(num.subtract(4, 4))

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY