Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 11 pts A UML class diagram Flag this Question Question 21 pts Consider

ID: 3914141 • Letter: Q

Question

Question 11 pts

A UML class diagram

Flag this Question

Question 21 pts

Consider the following code:

class Multiplier:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0

    def getProduct(self):
        return self.num1 * self.num2

def main():
    m = Multiplier()
    m.num1 = 7
    m.num2 = 3
    print(m.num1, "X", m.num2, "=", m.getProduct())

if __name__ == "__main__":
    main()

What is (are) the methods of the class?

Flag this Question

Question 31 pts

Consider the following code:

class Rectangle:
    def __init__(self, height, width):
        self.height = height
        self.width = width

    def getPerimeter(self):
        perimeter = self.height * 2 + self.width * 2
        return perimeter

    def getArea(self):
        area = self.height * self.width
        return area

    def getStr(self):
        return str(self.height) + " by " + str(self.width)

How many public attributes does this class define?

Flag this Question

Question 41 pts

Consider the following code:

class Rectangle:
    def __init__(self, height, width):
        self.height = height
        self.width = width

    def getPerimeter(self):
        perimeter = self.height * 2 + self.width * 2
        return perimeter

    def getArea(self):
        area = self.height * self.width
        return area

    def getStr(self):
        return str(self.height) + " by " + str(self.width)

How many public methods does this class define?

Flag this Question

Question 51 pts

Consider the following code:

class Die:
    def __init__(self):
        self.__value = 1

    def getValue(self):
        return self.__value
                
    def roll(self):
        self.__value = random.randrange(1, 7)

Given a Die object named die, which of the following will print the value of the __value attribute to the console?

Flag this Question

Question 61 pts

Consider the following code:

class Multiplier:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0

    def getProduct(self):
        return self.num1 * self.num2

def main():
    m = Multiplier()
    m.num1 = 7
    m.num2 = 3
    print(m.num1, "X", m.num2, "=", m.getProduct())

if __name__ == "__main__":
    main()

What is (are) the attributes of the class?

Flag this Question

Question 71 pts

Given a class named Customer, which of the following creates a Customer object and assigns it to the variable named cust1:

Flag this Question

Question 81 pts

Given a variable named p that refers to a Product object, which of the following statements accesses the price attribute of the Product object?

Flag this Question

Question 91 pts

In a method, the first parameter, which is usually named self, refers to the current

Flag this Question

Question 101 pts

The methods contained in an object that has been created from a class is its __________.

describes the functions of one or more modules

Explanation / Answer

A UML class diagram

describes the attributes and methods of one or more classes

=============================================================================Consider the following code:

class Multiplier:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0

    def getProduct(self):
        return self.num1 * self.num2

def main():
    m = Multiplier()
    m.num1 = 7
    m.num2 = 3
    print(m.num1, "X", m.num2, "=", m.getProduct())

if __name__ == "__main__":
    main()

What is (are) the methods of the class?

getProduct()

__init__()

=============================================================================

Consider the following code:

class Rectangle:
    def __init__(self, height, width):
        self.height = height
        self.width = width

    def getPerimeter(self):
        perimeter = self.height * 2 + self.width * 2
        return perimeter

    def getArea(self):
        area = self.height * self.width
        return area

    def getStr(self):
        return str(self.height) + " by " + str(self.width)

How many public attributes does this class define?

2 height and weight

=============================================================================

Consider the following code:

class Die:
    def __init__(self):
        self.__value = 1

    def getValue(self):
        return self.__value
                
    def roll(self):
        self.__value = random.randrange(1, 7)

ans:print(die.__value)

===================================================

Consider the following code:

class Multiplier:
    def __init__(self):
        self.num1 = 0
        self.num2 = 0

    def getProduct(self):
        return self.num1 * self.num2

def main():
    m = Multiplier()
    m.num1 = 7
    m.num2 = 3
    print(m.num1, "X", m.num2, "=", m.getProduct())

if __name__ == "__main__":
    main()

ans:num1,num2

=====================================================================

Given a class named Customer, which of the following creates a Customer object and assigns it to the variable named cust1

cust1 = Customer.init()

=================================================================

Given a variable named p that refers to a Product object, which of the following statements accesses the price attribute of the Product object?

p.price

===================================================================

In a method, the first parameter, which is usually named self, refers to the current

instance of a class

===================================================

The methods contained in an object that has been created from a class is its __________.

identity

=============================================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote