University of Arkansas



CSCE 2004 – Programming Project 7Midpoint Due Date – 12/04/2020 Final Due Date – 12/10/2020 1. Problem Statement:The Pokémon trading card game has been hugely popular since it came out in 1999. In fact, there is a whole industry built around the buying/selling these cards. If you look at eBay, you will discover that there is some serious money in Pokémon cards. Some of the rare first edition cards sell for thousands of dollars. The goal of this programming project is to design, implement and test a program that will let the user keep track of their Pokémon card collection. Your program must have functions for reading and writing information about Pokémon cards from an ASCII text file and storing this data in an array of Pokémon objects. Your program must also have functions that calculate how much profit the user makes buying and selling Pokémon cards, what the most valuable card is in the collection, and how much the current card collection is worth. To simplify your project, you will be given the implementation of a simple Pokémon class that you can extend as needed to create your array of Pokémon objects. This class has six private variables to store essential information about Pokémon cards: int Number – the Pokémon card number between 1 and 102.string Name – the name of the Pokémon character.int Grade – the PSA grade for the card between 1 and 10.string Edition – the print edition (First, Shadowless, or Unlimited).float PurchasePrice – the amount paid for the card when purchased.float SalePrice – the amount received for the card when sold.This Pokémon class has the usual constructor functions, getters and setters, and methods for reading and writing information about one Pokémon card. A very simple main program is provided to test this Pokémon class. The C++ code for this Pokémon class is posted on the course website.Detailed Program Requirements:Your main program should contain a fixed size array of Pokémon objects. The size of this array should be large enough for a typical card collection, and can be stored in a global constant. Your program should also have a variable for keeping track of how many cards are currently stored in this array, which should be incremented as cards are added.You program should have a function for reading an ASCII text file containing Pokémon information into the array of Pokémon objects. The format of this file is six lines of information per Pokémon card with data fields in the same order as the private variables listed above. There will be a blank line between each group of six lines to make the ASCII file easier to read and edit. Your program should perform error checking when reading this ASCII file to make sure the six private variables are all within their expected ranges. Your program should have a function for writing an ASCII text file with the current contents of the Pokémon object array. The output format should be the same as the input format (six lines of information per Pokémon card and one blank line) so you can read the data back in again the next time the program is executed.Your program should have a function that prints the current contents of the Pokémon object array to the screen for the user to view. Your function should also print out the number of cards currently stored in the array.Your program should have a function that updates the Pokémon object array when the user buys a new Pokémon card. This function should prompt the user to enter information about the Pokémon card and update the array accordingly. The user’s collection is allowed to have duplicate Pokémon cards. These duplicates may or may not have different PSA grades, editions, or prices.Your program should have a function that updates the Pokémon object array when the user sells one of their Pokémon cards. This function should prompt the user for what card to sell, search the Pokémon array to find the card, and if it is available to sell, update the object with the selling price. Your program should have a function that scans the Pokémon object array to locate the most valuable Pokémon card the user still owns based on purchase price, and print this information to the screen for the user.Your program should have a function that scans the Pokémon object array to calculate how much the current card collection is worth based on purchase price of cards the user still owns, and print this information to the screen.Finally, your main program should have a menu of commands that will let the user execute a sequence of commands where each command calls one of the seven functions above. Your program should continue executing commands until the user types “quit”. A typical interaction would have the user read the ASCII file, buy or sell several Pokémon cards, print how much the collection is currently worth, write the ASCII file, and then quit. BONUS (10 Points)Once you have your program working perfectly with seven functions being called in the main program, you can make your project more object oriented by creating a new PokemonCollection class. This class should two private variables, the fixed size array of Pokémon objects, and the count of many cards are currently stored in this array. Your class should have a constructor and destructor. You do not need to implement getters or setters. Instead you should create seven methods to perform the operations corresponding to the seven functions described above. You will not need to pass the array of objects or the count into these methods because they are private variables and can be accessed directly. Once you have your class implemented in “pokemon_collection.h” and “pokemon_collection.cpp” you can modify your main program to have one PokemonCollection object, and call the seven public methods above to implement your user interface.2. Design:For this assignment, most of your work will be in designing the seven functions described above. You will need to decide what parameters are needed, what the return type should be, and how to implement each function.Your second design task will be to decide what the user interface for your program will look like. Do you want to have the user enter commands by name or use numbers to select the command to execute? Your program should print instructions on how to use this user interface at the start of the program.3. Implementation:You are starting this programming project with an implementation of a Pokémon class in “pokemon.h” and “pokemon.cpp”. You are welcome to extend this class if needed to implement your project. You will also be given a simple “main.cpp” program that creates a Pokémon object and calls a variety of methods to test them.Finally, you will be given a sample ASCII text file containing information about 10 Pokémon cards. You should not change the format of this data file because we may want to test your program with different Pokémon data.Your program must implement seven functions to support the seven commands listed above. It would be a good idea to implement and test each of these functions separately, to verify that one function is working properly before going on to the next function. You should probably implement the reading function first. You are welcome to implement the other functions in any order.Remember to use good programming style when creating your program, with good names for variables and constants, proper indenting for loops and conditionals, clear comments, etc. Also, be sure to save backup copies of your program somewhere safe. Otherwise, you may end up retyping your whole program if something goes wrong.4. Testing:Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program with several input values, and save your testing output in text files for inclusion in your project report.5. Documentation:When you have completed your C++ program, write a short report using the “Programming Project Report Template” describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this project report in a separate document to be submitted electronically.6. Project Submission:In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic plagiarism analysis of all programs that are submitted. When you have completed the tasks above go to Blackboard to upload your documentation, and your C++ source code. Do NOT upload an executable version of your program.The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit:10% off if less than 1 day late,20% off if less than 2 days late,30% off if less than 3 days late,No credit if more than 3 days late. You will receive partial credit for all programs that compile even if they do not meet all program requirements, so handing projects in on time is highly recommended.7. Academic Honesty Statement:Students are expected to submit their own work on all programming projects, unless group projects have been explicitly assigned. Students are NOT allowed to distribute code to each other, or copy code from another individual or website. Students ARE allowed to use any materials on the class website, or in the textbook, or ask the instructor and/or GTAs for assistance.This course will be using highly effective program comparison software to calculate the similarity of all programs to each other, and to homework assignments from previous semesters. Please do not be tempted to plagiarize from another student.Violations of the policies above will be reported to the Provost's office and may result in a ZERO on the programming project, an F in the class, or suspension from the university, depending on the severity of the violation and any history of prior violations. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download