Mixed-Up Code QuestionsΒΆ

Create a class Person with a constructor that takes first_name and last_name and inititalize those attributes in the current object. Next, create a class called Customer that inherits from Person with a constructor that takes first_name, last_name, and id. Call the constructor in Person to initialize first_name and last_name and then also set the id attribute in the Customer object. For example, Person("Barb", "Ericson").last_name == "Ericson" and Customer("Barb", "Ericson", "a1").id == ``"a1".

Write a class Person with a constructor that takes first_name and last_name and inititalize those attributes in the current object. Next, create a class called Customer that inherits from Person with a constructor that takes first_name, last_name, and id. Call the constructor in Person to initialize first_name and last_name and then also set the id attribute in the Customer object. For example, Person("Barb", "Ericson").last_name == "Ericson" and Customer("Barb", "Ericson", "a1").id == ``"a1".

Create a class called Person with a constructor that takes name and age. Next, create a class called Student that inherits from Person. The constructor for Student takes name, age, and gpa. Have the constructor for the Student class call the constructor for the Person class to initialize the name and age and then set the value for the gpa. For example, Person('Susan', 13).name would be "Susan" and Student('Sally', 16, 3.7).gpa would be 3.7.

Write a class called Person with a constructor that takes name and age. Next, create a class called Student that inherits from Person. The constructor for Student takes name, age, and gpa. Have the constructor for the Student class call the constructor for the Person class to initialize the name and age and then set the value for the gpa. For example, Person('Susan', 13).name would be "Susan" and Student('Sally', 16, 3.7).gpa would be 3.7.

Create a class called Building with a constructor that inititalizes the attributes floors and sqft. Next, create a class called House that inherits from Building. The constructor for House should take floors, sqft, and bedrooms and call the construtor in Building to initialze the floors and sqft before setting the attribute bedrooms. For example, Building(15, 10000).floors would be 15 and House(3, 2000, 3).bedrooms would be 3.

Write a class called Building with a constructor that inititalizes the attributes floors and sqft. Next, create a class called House that inherits from Building. The constructor for House should take floors, sqft, and bedrooms and call the construtor in Building to initialze the floors and sqft before setting the attribute bedrooms. For example, Building(15, 10000).floors would be 15 and House(3, 2000, 3).bedrooms would be 3.

Create a class Account with an attribute of balance and methods of deposit and withdraw that both take an amount. For example, Account(200).withdraw(50) should set the balance to 150 and Account(200).deposit(100) should set the balance to 300.

Write a class Account with an attribute of balance and methods of deposit and withdraw that both take an amount. For example, Account(200).withdraw(50) should set the balance to 150 and Account(200).deposit(100) should set the balance to 300.

Create a class Animal with an attribute of name and a method make_noise that returns "Noise". Then create a Dog class that inherits from Animal. Have the constructor in Dog call the constructor in Animal to initialze the name. In Dog also override the make_noise method inherited from Animal to return "Bark". For example, Animal("Diana").make_noise() returns "Noise" and Dog("Percy").make_noise() returns "Bark".

Write a class Animal with an attribute of name and a method make_noise that returns "Noise". Then create a Dog class that inherits from Animal. Have the constructor in Dog call the constructor in Animal to initialze the name. In Dog also override the make_noise method inherited from Animal to return "Bark". For example, Animal("Diana").make_noise() returns "Noise" and Dog("Percy").make_noise() returns "Bark".

Create a class Animal with an attribute of name and a method make_noise that returns "Noise". Then create a Cat class that inherits from Animal. Have the constructor in Cat call the constructor in Animal to initialze the name. In Cat also override the make_noise method inherited from Animal to return "Meow". For example, Animal("Spike").make_noise() returns "Noise" and Cat("Diana").make_noise() returns "Meow".

Write a class Animal with an attribute of name and a method make_noise that returns "Noise". Then create a Cat class that inherits from Animal. Have the constructor in Cat call the constructor in Animal to initialze the name. In Cat also override the make_noise method inherited from Animal to return "Meow". For example, Animal("Spike").make_noise() returns "Noise" and Cat("Diana").make_noise() returns "Meow".

Given a class Point that has attributes of x and y and a method distance_to(self, other) that returns the distance between the current point (self) and the other point, create a MyCircle class that has a constructor that takes two attibutes p1 and p2 both objects of the class Point. Also create a radius method that returns the radius of the circle (half the distance between the two points that define circle).

Given a class Point defined below that has attributes of x and y and a method distance_to(self, other) that returns the distance between the current point (self) and the other point, write a MyCircle class that that has a constructor that takes two attibutes p1 and p2 both objects of the class Point. Also create a radius method that returns the radius of the circle (half the distance between the two points that define circle).

Given a class Item with an attributes of name and price, create an Order class that has an attribute item_list that is intitialized to the empty list in the constructor. Then add an add_item method that takes an item and appends it to the item_list attribute. Then create a get_total method that returns the total price for all the items in item_list attribute.

Given a class Item define below with attributes of name and price, write an Order class that has an attribute item_list that is intitialized to the empty list in the constructor. Then add an add_item method that takes an item and appends it to the item_list attribute. Then create a get_total method that returns the total price for all the items in item_list attribute.

Given a class Account with an attribute balance and methods of deposit and withdraw, create a SavingsAccount class that inherits from Account. Create a constructor that takes balance and interest. In the SavingsAccount constructor call the Account constructor to intitialze the balance and then initialize the interest. Then create a pay_interest method that adds the interest to the balance (divide the interest rate by 100 and multiply it by the balance to determine the amount to add).

Given a class Account with an attribute balance and methods of deposit and withdraw, create a SavingsAccount class hat inherits from Account. Write a constructor that takes balance and interest. In the SavingsAccount constructor call the Account constructor to intitialze the balance and then initialize the interest. Then create a pay_interest method that adds the interest to the balance (divide the interest rate by 100 and multiply it by the balance to determine the amount to add).

Given a class Treasure that has attributes of name and points, create a class Room that has attributes of name and treasures. Initialize treasures to the empty list in the constructor. Create a add_treasure method in Room that adds a passed Treasure object to treasures. Next create a get_points method in Room that returns the total of all of the points for the Treasure in treasures.

Given a class Treasure below that has attributes of name and points, create a class Room that has attributes of name and treasures. Initialize treasures to the empty list in the constructor. Create a add_treasure method in Room that adds a passed Treasure object to treasures. Next create a get_points method in Room that returns the total of all of the points for the Treasure in treasures.

You have attempted of activities on this page