UMBC Pokemon Center Database Project

Description

Note that the programs you will be writing for Part 2a through Part 2g build on one another. You will want to attempt these parts in order. You can also feel free to save all of your work in one big file

Pokemon is a series of Japanese video games and related media such as trading cards and television programs, featuring cartoon monsters that are captured by players and trained to battle each other. In this program you will be helping to build a Pokemon database system for a Pokemon center.

To begin you will be creating a simple menu system that will allow the user to look up which Pokemon are available at your Pokemon Center. Given the following lists, write a program that asks the user for a Pokemon name. Next, find out if the Pokemon Center has that Pokemon and report the status to the user. Allow the user to continually inquire about product names until they elect to quit the program.

Here are some lists to get you started:

# Pokemon listspokemon_names = ['charmander', 'squirtle', 'bulbasaur', 'gyrados']pokemon_amounts = [3, 2, 5, 1]

Note that these lists are related to one another – both lists have the same # of elements, and the position of each element indicates its relationship with the other list. For example, we have 3 ‘charmander’ at our Pokemon center. The string ‘charmander’ exists at position 0 in the first list, which relates the value at position 0 in the second list (the integer 3).

Here’s a sample running of your program. Note that the prompt contains a number of features that we haven’t built yet. Don’t worry about these features just yet — we will be adding these in future parts of the assignment.

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: hello worldUnknown command, please try againWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: pikachuWe do not have any Pikachu at the Pokemon CenterWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: SquirtleWe have 2 Squirtle at the Pokemon CenterWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: SQUIRTLEWe have 2 Squirtle at the Pokemon CenterWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: CHarManDerWe have 3 Charmander at the Pokemon CenterWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Some considerations for this part of the program:

  • Commands are case insensitive (‘s’ and ‘S’ are both valid for ‘search’)
  • Allow the user to type in any case variation of the Pokemon name (i.e. the strings ‘CHARMANDER’ and ‘charmander’ should both work when searching for that Pokemon)
  • When reporting the name of the Pokemon you should ensure that the first character is capitalized (i.e. ‘Charmander’, ‘Squirtle’, ‘Bulbasaur’, etc.)

Part 2b

Next, extend your program so that it keeps track the “adoption fee” for each type of Pokemon. Default your adoption fees to be $100.00 for Charmander, $50.00 for Squirtle, $25.00 for Bulbasaur and $1,000.00 for Gyrados. Hint: you might want to create a new list called pokemon_fees to store this data! – once you have this information in place you should modify your program to do the following:

  • Update the search feature to include a line to report the adoption fee for each Pokemon
  • Add a new feature that lists ALL Pokemon, their amounts and their adoption fees.
  • Standard credit: Format your table so that it lines up visually so that each column is exactly 20 characters wide. Column 1 should be left aligned, and columns 2 and 3 should be right aligned.
  • Extra credit: Format the columns so that they grow based on the contents of each list. The sizing of each column should appear as follows:
    • Column 1 (‘Name’): aligned left, minimum length of 5 characters, can grow to the length of the longest string in the pokemon_names list + 1 (i.e. if ‘charmander’ is the largest string in the list with 10 characters, so the column should be formatted to 11 characters wide)
    • Column 2 (‘Amount Available’): aligned right, minimum length of 20 characters, can grow to the length of the largest integer in the pokemon_amounts list + 1 (i.e. if the largest amount is 5 the column will be formatted to 20 characters long, but if the largest amount is 9999999999999999999999999 (25 9’s) the column would be formatted to 26 characters wide)
    • Column 3 (‘Adoption Fee’): aligned right, minimum length of 15 characters, can grow to the length of the size of the largest formatted float in the pokemon_fees list + 1. For example, if the largest float in the list is 10000000000000000000.0 the formatted version (2 decimal points, comma separator) would be ”10,000,000,000,000,000,000.00′ — this string has 29 characters, meaning that the column width should be 30.

Here’s a sample running of your program (which shows the ‘standard credit’ version of the assignment)

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: squirtleWe have 2 Squirtle at the Pokemon CenterIt will cost $50.00 to adopt this PokemonWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption FeeCharmander                             3              100.00Squirtle                               2               50.00Bulbasaur                              5               25.00Gyrados                                1            1,000.00Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Part 2c

Next, add in the ability to keep track of the “type” of each Pokemon. Each Pokemon has one or more “type” associated with it. For example, Charmander is of type “Fire”, Squirtle is of type “Water”, Bulbasaur is of type “Grass” and Gyrados has two types – “Water” and “Flying”. The following list contains these types organized for each of the 4 Pokemon you currently have in your center:

pokemon_types = [['fire'], ['water'], ['grass'], ['water', 'flying']]

Note how this is a “list of lists” – element 0 of the list is the little list [‘fire’]; element 1 of the list is the little list [‘grass’], and so on. We refer to this as a ‘multi-dimensional’ list in computer programming. You can access lists inside of lists by using more than one set of square brackets. For example, to extract the value ‘water’ from the list above you can do the following:

print(pokemon_types[3][0])

Your task is to incorporate this list into your program and report the “type” of each Pokemon when using the “search” and “list” features. Note that you probably don’t need to format these types because they will be the last thing that you print on each line of output when using the “search” feature.

Here’s a sample running of your program with these features added:

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: SquirtleWe have 2 Squirtle at the Pokemon CenterIt will cost $50.00 to adopt this PokemonSquirtle has the following types: Water Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: sName of Pokemon to search for: GYRADOSWe have 1 Gyrados at the Pokemon CenterIt will cost $1,000.00 to adopt this PokemonGyrados has the following types: Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Note that for the “list” feature you are adding a new column. This column should be left aligned and doesn’t need to be formatted to a specific size (it’s the last column in the table and nothing comes after it)

Part 2d

Next build in a feature that allows the user to search by type of Pokemon. The program should find all Pokemon of that type and display it using the “list” interface that you built above. Hint: you might want to copy the code you wrote for that part and make some changes to it to handle this new feature. The same column sizing rules apply for this (20 characters for standard credit, dynamic sizing for extra credit). Here’s a sample running of this part of the program:

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: tEnter Pokemon type: poisonWe have no Pokemon of that type at our Pokemon CenterWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: tEnter Pokemon type: fireName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: tEnter Pokemon type: waterName                    Amount Available        Adoption Fee Type(s)Squirtle                               2               50.00 Water Gyrados                                1            1,000.00 Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Part 2e

Next, add in an “add” feature that lets users add a new Pokemon to the center. When you add a product you will need to ask the user for the name of the Pokemon, the adoption fee and how many Pokemon the Center has available to sell. Validate this data – you cannot add a Pokemon that already exists and both the cost and amount must be positive.

In addition, the “type” must also be validated to be one of a small number of possible types. Here are all possible valid types for the purpose of your program:

valid_pokemon_types = ['bug', 'dark', 'dragon', 'electric', 'fairy', 'fighting', 'fire', 'flying', 'ghost', 'grass', 'ground', 'ice', 'normal', 'poison', 'psychic', 'rock', 'steel', 'water']

Your program should allow the user type in multiple ‘types’ for each Pokemon. If the user requests it they should be able to access this list to see the valid types they can supply for a Pokemon. Use a sentinel value of “end” to stop accepting new Pokemon types. Hint: use an empty list to store your Pokemon types.

Here’s a sample running of the program with this feature:

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: aEnter name of new pokemon: squirtleDuplicate name, add operation cancelledWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: aEnter name of new pokemon: ButtERFreeHow many of these Pokemon are you adding? -5Invalid, please try againHow many of these Pokemon are you adding? -3Invalid, please try againHow many of these Pokemon are you adding? 3What is the adoption fee for this Pokemon? -50.72Invalid, please try againWhat is the adoption fee for this Pokemon? 0Invalid, please try againWhat is the adoption fee for this Pokemon? 25.12Next you will be prompted to enter the 'types' for this Pokemon.  Pokemon can have multiple types. Type 'help' to view all possible Pokemon types, and type 'end' to stop entering types. You must enter at least one valid 'type'What type of Pokemon is this? help* bug* dark* dragon* electric* fairy* fighting* fire* flying* ghost* grass* ground* ice* normal* poison* psychic* rock* steel* waterWhat type of Pokemon is this? invisibleThis is not a valid type, please try againWhat type of Pokemon is this? flyingType flying addedWhat type of Pokemon is this? BUGType bug addedWhat type of Pokemon is this? endPokemon Added!Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Butterfree                             3               25.12 Flying Bug Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Part 2f

Next, add in a “remove” feature that lets users remove Pokemon from the database. Here’s a sample running of the program:

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: aEnter name of new pokemon: weedleHow many of these Pokemon are you adding? 5What is the adoption fee for this Pokemon? 72.15Next you will be prompted to enter the 'types' for this Pokemon.  Pokemon can have multiple types. Type 'help' to view all possible Pokemon types, and type 'end' to stop entering types. You must enter at least one valid 'type'What type of Pokemon is this? bugType bug addedWhat type of Pokemon is this? poisonType poison addedWhat type of Pokemon is this? endPokemon Added!Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Weedle                                 5               72.15 Bug Poison Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: rEnter name of Pokemon to remove: pikachuPokemon not found, cannot removeWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Weedle                                 5               72.15 Bug Poison Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: rEnter name of Pokemon to remove: squirtlePokemon removedWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Weedle                                 5               72.15 Bug Poison Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: rEnter name of Pokemon to remove: squirtlePokemon not found, cannot removeWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: rEnter name of Pokemon to remove: weedlePokemon removedWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Part 2g

Finally, add in a reporting feature to your program that finds the highest priced Pokemon, the lowest priced Pokemon and the total cost to adopt all Pokemon in the center (Pokemon cost * Pokemon quantity). Here’s a sample running of your program:

Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: eHighest priced Pokemon: Gyrados @ $1,000.00 per PokemonLowest priced Pokemon: Bulbasaur @ $25.00 per PokemonTotal cost to adopt all Pokemon in the Center: $1,525.00Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: aEnter name of new pokemon: mewHow many of these Pokemon are you adding? 7What is the adoption fee for this Pokemon? 25000.00Next you will be prompted to enter the 'types' for this Pokemon.  Pokemon can have multiple types. Type 'help' to view all possible Pokemon types, and type 'end' to stop entering types. You must enter at least one valid 'type'What type of Pokemon is this? psychicType psychic addedWhat type of Pokemon is this? endPokemon Added!Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: lName                    Amount Available        Adoption Fee Type(s)Charmander                             3              100.00 Fire Squirtle                               2               50.00 Water Bulbasaur                              5               25.00 Grass Gyrados                                1            1,000.00 Water Flying Mew                                    7           25,000.00 Psychic Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: eHighest priced Pokemon: Mew @ $25,000.00 per PokemonLowest priced Pokemon: Bulbasaur @ $25.00 per PokemonTotal cost to adopt all Pokemon in the Center: $176,525.00Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: rEnter name of Pokemon to remove: bulbasaurPokemon removedWelcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: eHighest priced Pokemon: Mew @ $25,000.00 per PokemonLowest priced Pokemon: Squirtle @ $50.00 per PokemonTotal cost to adopt all Pokemon in the Center: $176,400.00Welcome to the Pokemon Center!(a)dd, (r)emove, r(e)port, (s)earch by name, search by (t)ype, (l)ist or (q)uit: qSee you next time!

Remember that you only need to submit the final part of this assignment (part G) which will include the functionality of all of the previous parts.

Get your college paper done by experts

Do my question How much will it cost?

Place an order in 3 easy steps. Takes less than 5 mins.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *