COMP2401A – Assignment 5
Prerequisites
Please review the lectures up to and including Module 15 – Scripting.
Download the csv file containing Pokemon descriptions.
Learning Objectives
• Convert a set of requirements into the program design and implement running code
• Manipulate file data using a Linux Bourne (sh) shell script
Learning Outcomes
1. You will learn how to augment your applications with shell scripts
Pokemon Partitioning Script
The goal of this assignment is to develop a Bourne shell script that helps gamers explore the
properties of Pokemon:
You are a Programmer/System Administrator. Gamers really like Pokemon games and
trading cards. In order to improve thier Pokemon gaming abilities Gamers need to
explore the properties of different Pokemon. A CSV file listing all Pokemon and their
properties is available in the public domain. Earlier you developed a C application that
allows Gamers to query the CSV file, but they are unhappy with the application
performance. To help improve the performance of your application you want to introduce
a pre-processing step to partition the CSV file by Pokemon type. Partitioning the data
often improves the speed of queries. Because this step is not performed very often, and to
save coding effort, you decided to implement the partitioning step using a Bourne shell
script.
© Copyright: Mikhail Genkin, 2021
Legal Disclaimer
Pokemon and all related images, trademarks and copyrights are property of their rightful owners.
This assignment is intended as a fun learning exercise and is not intended to infringe on any of
these copyrights and trademarks. Please consult this site for legal obligations regarding
Pokemon: https://www.pokemon.com/us/
Functional Requirements
Use Case 1 – Administrator runs the partitioning script.
Actor: System Administrator (for the assignment this is the same person as the developer - you)
Steps:
1. The System Administrator starts the partitioning script using Linux terminal.
2. The partitioning script reads the pokemon.csv file and:
a. For each unique Pokemon type (Type 1) creates a sub-directory (in the directory
containing pokemon.csv - you can assume that the script will be run in that
directory) named as the Pokemon type – e.g. if Type 1 is Electric, then a subdirectory named Electric is created
b. In the Pokemon type sub-directory it creates a file named after the pokemon
type and gives it the csv extension – e.g. if Type 1 is Electic, then the name of the
file will be Electric.csv
c. The partitioning script writes all lines from pokemon.csv that describe the
Pokemon of that type into the matching type partition csv file – e.g. if Type 1 is
Electic, then all lines that contain Type 1 = Electric Pokemon into the
Electric/Electric.csv file
d. The source pokemon.csv file is not moved or modified by the partitioning script
e. The partitioning script deletes any temporary or intermediate files (if any)
NFR1 – Performance
The query program must be very fast – especially when Pokemon are queried by type.
Deliverables
This assignment will have two deliverables and will use the same grading approach as the
previous assignments (please refer to the previous announcement in Brighspace for details):
1. Design document (3 pages maximum length).
a. Submitted in PDF format.
b. For full marks it should:
© Copyright: Mikhail Genkin, 2021
i. Include pseudo-code and/or flow chart(s) that explain how your script
will work.
ii. Explain which Linux commands/programs you chose to use and why
iii. Use headings to organize the document
iv. Be legible and easy to follow
2. Bourne shell script code.
a. For full marks the script should:
i. Run without error and correctly create the artifacts described in Use Case
1 (it can be assumed that the grader has the required Linux permissions
to run the script successfully).
ii. Include helpful comments and follow the recommended style guidelines
described in Module 15 – Scripting.
标签:partitioning,script,type,COMP2401A,问题,file,csv,Pokemon From: https://www.cnblogs.com/longtimeagos/p/17643769.html