Page 1 of 1

Beings from different planets in various galaxies often come to make new homes on the planet Lemuria and are then called

Posted: Thu Jul 14, 2022 2:28 pm
by answerhappygod
Beings from different planets in various galaxies often come tomake new homes on the planet Lemuria and arethen called Limurians. In fact, everyone on Lemuria previously camefrom somewhere else. Every now and thenLimurians travel back to their original home planet at the rate oflimspeed, which is 5000 limmetres perlimminute, for a visit.Design, implement and test a Python class, Limurian, to generateobjects which represent Limurians onplanet Lemuria, with the following attributes/instance variablesand class variables:Class variables:• Population, which is initialized to 1500, is a class variablethat keeps track of the total population of theplanet Lemuria over time. As new objects are created (i.e., newLimurians come to the planet), thepopulation number is automatically incremented by 1. Hence, whenthe first object is created, the
population should be changed to 1501, when the second object iscreated, the population should bechanged to 1502, etc.• Lim_ID_Generator, which is initalized to 3000, is a classvariable that is used to generate the limID(see below) for a new object by increasing the previous ID (3000)by 2 and appending the first threecharacters of the name of the Limurian. For example, if the name ofthe Limurian is Shrilim, then the id forShrilim should be 3002Shr. When the next object is created with thename Bhavlim, its ID would be3004Bha. Etc.• LIMSPEED, which is set to 5000, is the number of limmetres perlimminute that Limurians travel whengoing back to their original planet.Instance variables:• limID is 2 more than the value of the class varaibleLim_ID_Generator, with the first threecharacters of the Limurian’s name appended, as describedabove• limName is the name of the Limurian• distanceFromOrig is the distance from planet Lemuria to theLimurian’s original home planet, inlimmetresAlso include the following methods:• constructor method for the Limurian class• accessor method getLimID to retrieve the ID of the Limurian• accessor method getDistance to retrieve the distance of theLimurian’s home planet from the planetLemuria• mutator method updateDistance to change the distance from Lemuriato the Limurian’s originalplanet• method computeTravelTime to compute the amount of travel time, inlimminutes, that it takes aLimuria to travel to and from the Limuria’s original homeplanet• special __str__ method to return the information about theLimurian, including the limID, limName,distanceFromOrig and the time taken to travel to and from theiroriginal planet, with appropriatedescriptive labels, as shown in the sample outputAlso include a main function to test the defined class asfollows:• create 3 Limurian objects• print information about each Limurian using the __str__method• update the distanceFromOrig of the second Limurian and print theLimurian’s ID, the old distance,and the updated distance with appropriate descriptive labels, asshown in the sample output• print the current population of Limurians on the planet with anappropriate descriptive labelCall the file containing your class and main function,planet_lemuria.py.
Sample input/output:ID: 3002ShrName: ShrilimDistance to original planet: 15000 limmetresTravel time to and from original planet: 6.0 limminutesID: 3004CenName: CentaurilimDistance to original planet: 25000 limmetres
Travel time to and from original planet: 10.0 limminutesID: 3006BhaName: BhavlimDistance to original planet: 45000 limmetresTravel time to and from original planet: 18.0 limminutesThe distance to original planet for Limurian with ID 3004Cen hasbeenupdated from 25000 limmetres to 200000 limmetres.The current population of planet Lemuria is 1503