Starting from:

$34.99

COP3502 Project 3 -Pakudex Project Python Solution



Overview
This project will provide students with practice building and working with object-oriented programming constructs including classes and objects by building classes to represent creatures and a cataloguing system.
Scenario
NOTE: This project concept is a work of satire. To state the obvious: we do not advise one to go around imprisoning creatures in small receptacles held in one’s pockets and/or having them fight for sport.


Of course, keeping track of all these critters can be a real task, especially when you are trying to steal so many of them at such a young age! You’ve decided to cash in – hey, if you don’t someone else will – on the morally ambiguous phenomenon by developing an indexing system – a pakudex – for kids and adult participants.
Requirements
Students will construct three classes: a driver class with a main() entry point (pakuri_program) and two data object classes (pakuri and pakudex). All attributes / methods must be private unless noted in the specification!
Welcome to Pakudex: Tracker Extraordinaire!
Enter max capacity of the Pakudex: 30 The Pakudex can hold 30 species of Pakuri.

Pakudex Main Menu
-----------------
1. List Pakuri
2. Show Pakuri
3. Add Pakuri
4. Evolve Pakuri
5. Sort Pakuri
6. Exit

What would you like to do?

pakuri_program Class (Driver / Program)
When run, the program should…

1) Display a welcome message
2) Prompt for / read pakudex capacity & confirm
3) Display the menu
4) Prompt for input



Listing Pakuri
This should number and list the critters in the pakudex in the order contained. For example, if “Pikaju” and “Charasaurus” were added to the pakudex (in that order), before sorting, the list should be:

Success Failure
Pakuri In Pakudex:
1. Pikaju
2. Charasaurus No Pakuri in Pakudex yet!

Pakudex Main Menu

Show Pakuri
The program should prompt for a species and collect species information, then display it:

Success Failure
Enter the name of the species to display: PsyGoose

Species: PsyGoose
Attack: 65
Defense: 57
Speed: 61 Enter the name of the species to display: PsyDuck Error: No such Pakuri!

Pakudex Main Menu
-----------------
1. List Pakuri

Adding Pakuri
When adding a pakuri, a prompt should be displayed to read in the species name, and a confirmation displayed following successful addition (or failure).

Success Failure – Duplicate
Enter the name of the species to add: PsyGoose
Pakuri species PsyGoose successfully added!

Pakudex Main Menu
-----------------
Enter the name of the species to add: PsyGoose Error: Pakudex already contains this species!
Error: Pakudex is full!
Failure – Full

Evolve Pakuri
The program should prompt for a species and then cause the species to evolve if it exists:

Success Failure
Enter the name of the species to evolve: PsyGoose PsyGoose has evolved! Enter the name of the species to evolve: PsyDuck Error: No such Pakuri!

Sort Pakuri
Sort pakuri in Python standard lexicographical order: Pakuri have been sorted!
(Hint: Use Sort() Function)

Exit
Thanks for using Pakudex! Bye!
Quit the program:

pakuri Class
This class will be the blueprint for the different critter objects that you will create. You will need to store information about the critter’s species, attack level, defense level, and speed. All variables storing information about the critters must be private (in accessible from outside of the class). We recommend (but do not mandate) the following variable types and names:

species; (Type: String)
attack, defense, speed; (Type: Int)

These attack, defense, and speed levels should have the following initial values when first created:

Attribute Value
attack (len(species) * 7) + 9
defense (len(species) * 5) + 17
speed (len(species) * 6) + 13



The class must also have the following methods and behaviors (this is mandatory):

__init__(self, species)
Initialize the pakuri object with species attribute

def get_species(self)
Returns the species of this critter

def get_attack(self)
Returns the attack value for this critter

def get_defense(self)
Returns the defense value for this critter

def get_speed(self)
Returns the speed of this critter

def set_attackself, new_attack)
Changes the attack value for this critter to new_attack

def evolve(self)
Will evolve the critter as follows: a) double the attack; b) quadruple the defense; and c) triple the speed


pakudex Class
The pakudex class will contain all the pakuri that you will encounter as pakuri objects. Note: The pakudex will have a set size determined by user input at the beginning of the program’s run; the number of species contained in the pakudex will never grow beyond this point.


The class must also have the following methods and behaviors (this is mandatory):

def __init__(self, capacity=20)
Initializes this object to contain exactly capacity objects when completely full. The default capacity for the pakudex should be 20

def get_size(self)
Returns the number of critters currently being stored in the pakudex
def get_capacity(self)
Returns the number of critters that the pakudex has the capacity to hold at most
def get_species_array(self)
Returns a String array containing the species of the critters as ordered in the pakudex; if there are no species added yet, this method should return None

def get_stats(self, species)
Returns an int array containing the attack, defense, and speed statistics of species at indices 0, 1, and 2 respectively; if species is not in the pakudex, returns None

def sort_pakuri(self)
Sorts the pakuri objects in this pakudex according to Java standard lexicographical ordering of species name

def add_pakuri(self, species)
Adds species to the pakudex; if successful, return true, and false otherwise

def evolve_species(self, species)
Attempts to evolve species within the pakudex; if successful, return true, and false otherwise

Submissions
NOTE: Your output must match the example output *exactly*. If it does not, you will not receive full credit for your submission!

MAKE SURE YOUR CLASSES ARE DEFINED WITH LOWERCASE LETTERS AS SHOWN BELOW!
Files: pakuri_program.py, pakuri.py, pakudex.py
Method: Submit on ZyLabs

More products