Question: Goal: Learn to define classes with internal state, and getter and setter methods. Question Goal: Learn to define classes with internal state, and getter and

Goal: Learn to define classes with internal state, and getter and setter methods. Question
Goal: Learn to define classes with internal state, and getter and setter methods.
Assignment: Write the definition of a class named Asteroid that has the following methods:
An init method that initializes the following attributes:
An attribute width that should be assigned 0.0 ;
An attribute height that should be assigned 0.0 ;
An attribute depth that should be assigned 0.0 ;
An attribute speed that should be assigned 0.0.
A method set_size that accepts three arguments and assigns the first to width, the second to height, and the third to depth;
A method set_speed that accepts one argument and assigns it to speed;
A method get_size that returns a tuple of three items, the first being width, the second height, and the third depth;
A method get_speed that returns the value of speed.
Assignment: Write the definition of a class named Asteroid that has the following methods:
An __init__ method that initializes the following attributes:
An attribute width that should be assigned 0.0;
An attribute height that should be assigned 0.0;
An attribute depth that should be assigned 0.0;
An attribute speed that should be assigned 0.0.
A method set_size that accepts three arguments and assigns the first to width, the second to height, and the third to depth;
A method set_speed that accepts one argument and assigns it to speed;
A method get_size that returns a tuple of three items, the first being width, the second height, and the third depth;
A method get_speed that returns the value of speed
 Goal: Learn to define classes with internal state, and getter and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!