Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Classes
#15
What i have to do is that:
part 1:
Set superclass and subclasses. Do not forget to keep information about the "penalty" that each different type of object will bring, and you should also keep the information specific for each type of object (dimensions). Set in all classes the appropriate methods for retrieving and storing a new value for each attribute of class
part 2:
Create a list where you will place 12 items.
- The creation of objects should be done with a repeating structure.
- The type of each new object will be determined in a random fashion.
For implementation, we will assume that all objects of the same type will have the same characteristics
For each new object, a pair of coordinates (x, y) will be randomly generated and will be checked if any other space object already exists at this point. If there is another object at this point, then the process of creating new, random coordinates will be repeated until a point is found in which there is no other space object. Once such a point has been found, the new space object will occupy it. –
You should be careful that the random co-ordinates produced are within the "grid ".
PART 3:
in order to be able to check the correctness of your implementation, you decide to add a printMessage () method to each of the subclasses you created in Question A. Considering that an object is at the coordinates (x, y), the method above should print the following message (of course, in the position of x, y, length, width, height, radius the actual values of each object must be printed):
- For triangle class object:
You hit triangle of size (x, y).
- For sphere class object:
You hit sphere of radius radius at (x, y).

Everything is a bit confusing!That's why i want to give up.
Reply


Messages In This Thread
Help with Classes - by Lonewolf - Feb-14-2019, 05:13 PM
RE: Help with Classes - by woooee - Feb-14-2019, 08:06 PM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 08:05 AM
RE: Help with Classes - by buran - Feb-15-2019, 09:44 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 10:06 AM
RE: Help with Classes - by buran - Feb-15-2019, 10:39 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 11:07 AM
RE: Help with Classes - by buran - Feb-15-2019, 11:32 AM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 04:55 PM
RE: Help with Classes - by buran - Feb-15-2019, 07:38 PM
RE: Help with Classes - by Lonewolf - Feb-15-2019, 09:17 PM
RE: Help with Classes - by buran - Feb-15-2019, 09:34 PM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:09 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:18 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:22 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:22 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 08:55 AM
RE: Help with Classes - by buran - Feb-16-2019, 08:25 AM
RE: Help with Classes - by buran - Feb-16-2019, 09:02 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 09:17 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 10:52 AM
RE: Help with Classes - by buran - Feb-16-2019, 11:25 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 11:29 AM
RE: Help with Classes - by buran - Feb-16-2019, 11:46 AM
RE: Help with Classes - by Lonewolf - Feb-16-2019, 11:50 AM
RE: Help with Classes - by Lonewolf - Feb-17-2019, 03:17 PM
RE: Help with Classes - by Lonewolf - Feb-17-2019, 06:48 PM
RE: Help with Classes - by Lonewolf - Feb-18-2019, 08:07 AM
RE: Help with Classes - by Lonewolf - Feb-18-2019, 05:35 PM
RE: Help with Classes - by sonedap - Feb-18-2019, 08:44 PM
RE: Help with Classes - by sonedap - Feb-19-2019, 06:56 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020