Question: These 5 questions are from the same section. Plz using Python 3!! WorkBench 3 Topics CH10 Astronomy>Classes> class definition> Exercise: 51226 ints Deadline: 12/07/18 11:00pm
WorkBench 3 Topics CH10 Astronomy>Classes> class definition> Exercise: 51226 ints Deadline: 12/07/18 11:00pm PST 244 1 Results 35 63 58 45 25 Instructions Write the definition of a class Counter containing An instance variable named counter of type int. A constructor that takes one int argument and assigns its value to counter A method named increment that adds one to counter. It does not take parameters or return a value A method named decrement that subtracts one from counter. It also does not take parameters or return a value. A method named get value that returns the value of the instance variable counter 13 13 History: x(13 of 13) 12/01/1801:17:35 def init (self, counter) t(self): def decrement (self) self.counter-self.counter-1 9 def get value(self): 10 return self.counter 63 25 You almost certainly should be using:+ You almost certainly should be using:- self.counter counter Python3 Topics > CH10 Astronomy > Classes > class definition > Exercise: 51227 ? Deadline: 12/07/18 11:00pm PST WorkArea Instructions Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named 1imit of type int A constructor that takes two int arguments and assigns the first one to counter and the second one to limit A method named increment. It does not take parameters or return a value; if the instance variable counter is less than linit, increment just adds one to the instance variable counter A method named decrement. It also does not take parameters or return a value; if counter is greater than zero, it just subtracts one from the counter. A method named get_ value that returns the value of the instance variable counter History: (no su o Submit Type your solution here... WorkBench Python3 Topics> CH10 Astronomy > Classes > class definition> Exercise: 51244 Deadline: 12/07/18 11:00pm WorkArea Instructions Write the definition of a class Player containing: A variable name, initialized to the empty String. A variable score, initialized to zero. A method called set_name that has one parameter, whose value it assigns to the instance variable name. A method called set score that has one parameter, whose value it assigns to the instance variable score. A method called get name that has no parameters and that returns the value of the instance variable name. A method called get score that has no parameters and that returns the value of the instance variable score No constructor need be defined. History: (no subm o Submit solution here... Python3 Topics>CH10 Astronomy Classes > class definition> Exercise: 51245 0 WorkArea Deadline: 12/07/18 11:00pm Instructions Write the definition of a class contestResult containing: An instance variable winner of type String, initialized to the empty String An instance variable second place of type string, initialized to the empty String An instance variable third place of type String, initialized to the empty String. A method called set winner that has one parameter, whose value it assigns to the instance variable winner A method called set second place that has one parameter, whose value it assigns to the instance variable second_place. A method called set_ third place that has one parameter, whose value it assigns to the instance variable third_place. A method called get_ winner that has no parameters and that returns the value of the instance variable vinner A method called get se A method called get_ thi cond place that has no parameters and that returns the value of the instance variable ird place that has no parameters and that returns the value of the instance variable third place second_place. No constructor need be defined. History: (no Submit your solution here... Python3 Topics>CH10 Astronomy Classes s class definition Exercise: 51247 Deadline: 12/07/18 11:00pm WorkArea Instructions Write the definition of a class WeatherForecast that provides the following behavior (methods): A method called set skies that has one parameter, a String. A method called set high that has one parameter, an int A method called set low that has one parameter, an int. A method called get_skies that has no parameters and that returns the value that was last used as an argument in set _skies. A method called get_high that has no parameters and that returns the value that was last used as an argument in set_ high. A method called get low that has no parameters and that returns the value that was last used as an argument in set _low. No constructor need be defined. Be sure to define instance variables as needed by your "get / set methods. History: (no O Submit your solution here... obiect creation class definition 51225 51226 51227 51 244 051245 051247 22444
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
