Question

In C++ Instructions Project 2: Gotta Catch ‘Em All Due: July 16 by Midnight For this...

In C++
Instructions
Project 2: Gotta Catch ‘Em All
Due: July 16 by Midnight
For this project you will be designing and implementing a system, in C++, to catalogue Pokémon, their trainers, and the local Pokémon gyms. Your system should act as a database and allow the user to load in multiple tables of data, run basic queries on the data, and then store the data off for later use.
Additionally, sample input files will not be uploaded to Canvas, but can instead be found on the CSE machines at /home/jeh0289/public/csce2110/su19/proj2/ You can cd into that directory and copy input the files from there.
Also, as a reminder, all of the work for this project must be the sole product of the individual student. You may not share code or download solutions off the internet, as doing so will be considered cheating. If you are struggling with a concept or implementation, you are encouraged to contact the instructor or your TA’s for aid.
Requirements
This assignment has two parts: a design portion and an implementation portion.
Design Document
For the design portion, you must generate documentation, in PDF format, describing your system. The purpose of this is for you to explain not just what your system is doing, and how it is doing it, but why. You will need to justify your design decisions in a concise, informative manner. Justifications such as “I did this because it was easy” are not sufficient, as you should actually explain why a particular data structure or algorithm was more efficient, effective, or optimal. Additionally, commented code, while sometimes helpful in small examples, is not a sufficient explanation in and of itself. Your explanations and justifications are expected to be presented in prose and in paragraph format, i.e. not bulleted lists. Further, part of the evaluation of your design document is the apparent amount of thought and effort that went into its creation.
This document should be divided into three main parts, and should follow the provided template.
In the first part, in one or two paragraphs you should describe the project in your own words and give a brief overview of the problem. Do not copy and paste this from the instruction document.
For the second part, you should describe the data structures you used in your system. What, if any, objects or structs did you create to store data? How did you organize and manage them? What types of formal data structures did you make use of (trees, graphs, arrays, hashes, etc)? In a few paragraphs, describe in detail how you stored the various data elements in your system, and be sure to provide sufficient justification of your methodology.
For the third part, you should describe functionality of your system. How is data moved and transformed? How is it read in? How is it output? What are the various major functions you constructed and how do they work? In a few paragraphs, describe in detail how your system works, and be sure to provide sufficient justification of your methodology. You might also consider including diagrams to more easily visualize how all of the pieces fit together.

Input1.txt
pokemon1.txt pokemon
trainers1.txt trainers
gyms1.txt gyms

DISPLAY()
  

Input2.txt

pokemon1.txt pokemon
gyms1.txt gyms
trainers1.txt trainers

DISPLAY()
INSERT((45|Vileplume|Grass,Poison|Water,Fairy|Flying,Fire,Psychic,Ice),pokemon)
UPDATE((70|Weepinbell|Grass,Poison|Water,Fairy|Flying,Fire,Psychic,Ice),pokemon)
SELECT((4|*|*|*|*),gyms)
INSERT((Samuel|Oak|47|Boulder,Cascade,Thunder,Rainbow,Soul,Marsh,Volcano|Squirtle,Bulbasaur,Charmander),trainers)
DELETE((146|Zapdos|Electic,Flying|Fighting,Flying,Bug,Water|Rock,Ice),pokemon)
INSERT((7|Seafoam Gym|Seafoam Island|Blaine|Volcano Badge),gyms)
UPDATE((Ash|Ketchum|15|Boulder,Cascade,Thunder,Rainbow|Pikachu,Squirtle,Bulbasaur,Charmander),trainers)
SELECT((56|Primeape|Fighting|Normal,Rock,Steel,Ice,Dark|Flying,Psychic,Fairy),pokemon)
UPDATE((9|Pokemon League|Indigo Plateau|Elite Four|Glory),gyms)
DELETE((Ash|Ketchum|*|*|*),trainers)
DELETE((1|Pewter Gym|Pewter City|Brock|Boulder Badge),gyms)
SELECT((Ash|Ketchum|*|*|*),trainers)
DISPLAY()
WRITE()
Input3.txt
pokemon2.txt pokemon
trainers2.txt trainers
gyms2.txt gyms

DISPLAY()

Input4.txt
pokemon2.txt pokemon
trainers2.txt trainers
gyms2.txt gyms

DISPLAY()
SELECT((Will|Unknown|*|*|*),trainers)
INSERT((202|Wobbuffet|Psychic|Fighting,Psychic|Bug,Ghost,Dark),pokemon)
UPDATE((198|Murkrow|Dark,Flying|Ghost,Grass,Dark|Rock,Electric,Ice,Fairy),pokemon)
DELETE((Lance|Grayson|*|*|*),trainers)
INSERT((Ash|Ketchum|10|Boulder,Cascade,Thunder,Rainbow|Pikachu,Squirtle,Bulbasaur,Charmander),trainers)
SELECT((202|Wobbuffet|Psychic|Fighting,Psychic|Bug,Ghost,Dark),pokemon)
INSERT((15|Cinnabar Island Gym|Cinnabar Island|Blaine|Volcano Badge),gyms)
UPDATE((Ash|Ketchum|15|Boulder,Cascade,Thunder,Rainbow|Pikachu,Squirtle,Bulbasaur,Charmander),trainers)
UPDATE((17|Pokemon League|Indigo Plateau|Elite Four|Glory),gyms)
DELETE((17|Pokemon League|Indigo Plateau|Elite Four|Glory),gyms)
SELECT((17|*|*|*|*),gyms)
DELETE((206|Dunsparce|Normal|None|Weak),pokemon)
DISPLAY()
WRITE()


Pokemon1.txt
ID
ID,NAME,TYPE,STRONG_TO,WEAK_TO
145|Zapdos|Electic,Flying|Fighting,Flying,Bug,Water|Rock,Ice
25|Pikachu|Electric|Flying,Water|Ground
57|Primeape|Fighting|Normal,Rock,Steel,Ice,Dark|Flying,Psychic,Fairy
39|Jigglypuff|Normal,Fairy|Fighting,Dragon,Dark|Poison,Steel
94|Gengar|Ghost,Poison|Grass,Psychic,Fairy|Ground,Ghost,Psychic,Dark
70|Weepingbell|Grass,Poison|Water,Fairy|Flying,Fire,Psychic,Ice


Trainer1.txt
FIRSTNAME,LASTNAME
FIRSTNAME,LASTNAME,AGE,BADGES_HELD,POKEMON_OWNED
Ash|Ketchum|10|Boulder,Cascade,Thunder,Rainbow|Pikachu,Squirtle,Bulbasaur,Charmander
Brock|Harrison|15|Boulder|Onyx,Geodude,Graveler
Misty|Yawa|10|Boulder,Cascade|Staryu,Starmi,Togepi,Magikarp

pokemon2.txt
ID
ID,NAME,TYPE,STRONG_TO,WEAK_TO
152|Chikorita|Grass|Ground,Water,Grass,Electric|Flyring,Poison,Bug,Fire,Ice
198|Murcrow|Dark,Flying|Ghost,Grass,Dark|Rock,Electric,Ice,Fairy
246|Larvitar|Rock,Ground|Normal,Flying,Poison,Rock,Fire|Righting,Ground,Steel,Water,Grass,Ice
206|Dunsparce|Normal|None|Weak
Trainer2.txt
FIRSTNAME,LASTNAME
FIRSTNAME,LASTNAME,AGE,BADGES_HELD,POKEMON_OWNED
Will|Unknown|22|Soul,Rainbow,Marsh,Fog|Xatu,Exeggutor,Jynx,Slowbro,Xatu
Koga|Zagnit|35|Earth,Soul,Rainbow,Mineral|Ariados,Venomoth,Forretress,Muk,Crobat
Bruno|Morikawa|29|Insect,Storm,Boulder|Hitmontop,Hitmonchan,Hitmonlee,Machamp,Onix
Karen|Unknown|33|Earth,Soul,Rainbow,Fog,Zephyr|Umbreon,Vileplume,Gengar,Murkrow,Houndoom
Lance|Grayson|18|Zephyr,Insect,Plain,Fog,Storm,Mineral,Glacier,Rising,Thunder,Marsh,Rainbow,Soul,Cascade,Boulder,Volcano,Earth|Gyarados,Dragonite,Dragonite,Dragonite,Charizard,Aerodactyl


0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code for you:

import java.io.*;
import java.util.*;
class FitnessClubMembershipsFiles
{
public static void main(String[] args) throws FileNotFoundException
{
Scanner fs = (new Scanner(new File("memberships.txt")));
PrintWriter pw1 = new PrintWriter(new File("gym.txt"));
PrintWriter pw2 = new PrintWriter(new File("circuit.txt"));
int gymMembers = 0, circuitMembers = 0;
double gymMembershipFee = 0, circuitMembershipFee = 0;
while(fs.hasNext())
{
String firstName = fs.next();
String surname = fs.next();
int age = fs.nextInt();
String membershipType = fs.next();
double weightInKG = fs.nextDouble();
double feePaid = fs.nextDouble();
if(membershipType.equals("gym"))
{
gymMembers++;
gymMembershipFee += feePaid;
pw1.printf("%s\t%s\t%.2f\n", firstName, surname, feePaid);
}
else
{
circuitMembers++;
circuitMembershipFee += feePaid;
pw2.printf("%s\t%s\t%.2f\n", firstName, surname, feePaid);
}
}
pw1.close();
pw2.close();
System.out.println("No. of gym members: " + gymMembers + " Average fee paid: " + gymMembershipFee / gymMembers);
System.out.println("No. of circuit members: " + circuitMembers + " Average fee paid: " + circuitMembershipFee / circuitMembers);
}
}

And the output screenshot is:

Add a comment
Know the answer?
Add Answer to:
In C++ Instructions Project 2: Gotta Catch ‘Em All Due: July 16 by Midnight For this...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT