Question

In Python Classes/Methods: Kenmore has contacted you to help them create a class for their newest...

In Python

Classes/Methods: Kenmore has contacted you to help them create a class for their newest washing machine. Write the “WashingMachine” class that has the following specifications:

Methods:

  1. Add water - increments water level by 1
  2. Drain water - removes all water
  3. Spin – decreases the minutes left by 0.01
  4. getTime – returns number of minutes left
  5. setTime – sets the number of minutes to run
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Coding

import threading
class WashingMachine(threading.Thread):
    def __init__(self,water_level,time):
        self.water_level = water_level
        self.time = time*60
    def addwater(self):
        self.water_level+=1
    def DrainWater(self):
        self.water_level=0
    def WaterLevel(self):
        print(self.water_level)
    def settime(self):
        threading.Timer(1.0, self.settime).start()
        self.time=self.time-1
        print("timer is ::"+str(self.gettime()))
    def gettime(self):
        return(self.time)
w1 = WashingMachine(2,2)
print("Starting Water Level:");
w1.WaterLevel()
print("After Adding water Water Level:");
w1.addwater()
w1.WaterLevel()
print("After Draining water Water Level:");
w1.DrainWater()
w1.WaterLevel()
w1.settime()

Code:


output:

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........

Add a comment
Know the answer?
Add Answer to:
In Python Classes/Methods: Kenmore has contacted you to help them create a class for their newest...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLEASE DO THIS IN PYTHON!! Classes/Methods: Kenmore has contacted you to help them create a class...

    PLEASE DO THIS IN PYTHON!! Classes/Methods: Kenmore has contacted you to help them create a class for their newest washing machine. Write the “WashingMachine” class that has the following specifications: Attributes (should be invisible to users): Amount of water (number) Minutes left (the number of minutes left in the cycle) Water level (number indicating how many quarts of water are in the machine CLASS DECLARATION AND ATTRIBUTES ONLY (5 points):

  • using java : Kenmore has contacted you to help write code to control their new line...

    using java : Kenmore has contacted you to help write code to control their new line of home appliances. Write the “Refrigerator” class that has tracks the temperature of the refrigerator and the amount of water remaining in the water dispenser (max is 100 ounces). Kenmore also needs you to create a constructor and methods to increase or decrease the temperature along with dispensing water (8 ounces at a time) and refilling the water tank from a connected water hose....

  • python code? 1. Create a class called Person that has 4 attributes, the name, the age,...

    python code? 1. Create a class called Person that has 4 attributes, the name, the age, the weight and the height [5 points] 2. Write 3 methods for this class with the following specifications. a. A constructor for the class which initializes the attributes [2.5 points] b. Displays information about the Person (attributes) [2.5 points] c. Takes a parameter Xage and returns true if the age of the person is older than Xage, false otherwise [5 points] 3. Create another...

  • Write a Python class, Circle, constructed by a radius and two methods which will compute the...

    Write a Python class, Circle, constructed by a radius and two methods which will compute the area and the perimeter of a circle. Include the constructor and other required methods to set and get class attributes. Create instances of Circle and test all the associated methods. Write a Python class, Rectangle, constructed by length and width and a method which will compute the area of a rectangle. Include the constructor and other required methods to set and get class attributes....

  • JAVA PROGRAM. Write a program to implement a class Clock whose getHours and getMinutes methods return the current time a...

    JAVA PROGRAM. Write a program to implement a class Clock whose getHours and getMinutes methods return the current time at your location. Also include a getTime method that returns a string with the hours and minutes by calling the getHours and getMinutes methods. Provide a subclass WorldClock whose constructor accepts a time offset. For example, if you livein California, a new WorldCLock(3) should show the time in NewYork, three time zones ahead. Include an Alarm feature in the Clock class....

  • Create four classes, Trainee, JumpingCalculator, JumpingTraining, and TrainProgLoader. Save them to Trainee.java, JumpingCalculator.java, JumpingTraining.java, and TrainProgLoader.java....

    Create four classes, Trainee, JumpingCalculator, JumpingTraining, and TrainProgLoader. Save them to Trainee.java, JumpingCalculator.java, JumpingTraining.java, and TrainProgLoader.java. Code the classes as specified as follows. Compile and run to test the program. Trainee Class: This class represents a trainee. Fields : A private int data field named id; A private String data field named name; o a private boolean data field named jumpTrain; o a private static int data field named numOfTrainee; Methods: A constructor that takes id and name as the...

  • Using Python. You will create two classes and then use the provided test program to make sure your program works This m...

    Using Python. You will create two classes and then use the provided test program to make sure your program works This means that your class and methods must match the names used in the test program You should break your class implementation into multiple files. You should have a car.py that defines the car class and a list.py that defines a link class and the linked list class. When all is working, you should zip up your complete project and...

  • The following is for java programming. the classes money date and array list are so I are are pre...

    The following is for java programming. the classes money date and array list are so I are are pre made to help with the coding so you can resuse them where applicable Question 3. (10 marks) Here are three incomplete Java classes that model students, staff, and faculty members at a university class Student [ private String lastName; private String firstName; private Address address; private String degreeProgram; private IDNumber studentNumber; // Constructors and methods omitted. class Staff private String lastName;...

  • In java, create class BNode(T), which implements the interface TreeNode(T) interface methods: void setRight(TreeNode(T) right) -...

    In java, create class BNode(T), which implements the interface TreeNode(T) interface methods: void setRight(TreeNode(T) right) - sets right side of node, where right is the node to the right of this node void setRight(TreeNode(T) left) - sets left side of node, where left is the node to the left of this node TreeNode getRight() - gets the right node TreeNode getLeft() - gets the left node T getData() - gets the data within the node THEN, create class BT(E), which...

  • Project 4: Pet Store Objectives: Create multiple classes in an inheritance hierarchy Use an abstract class...

    Project 4: Pet Store Objectives: Create multiple classes in an inheritance hierarchy Use an abstract class Use polymorphism Use an ArrayList Assignment For this project, you get to write a simplified pet store inventory program in Java. To complete this, you will need to have the following classes: Main class PetStore class Pet class Bird class Reptile class Snake class Turtle class Main class: This class is a driver class for the PetStore class. It is not part of the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT