Object Oriented Programming Project 2: TrainingGym
January 24, 2019
1 Introduction
In this project, you will be creating a console based TrainingGym for Objectmon to fight in. You will have your first taste of inheritance, as well as using Javadocs to learn about existing functionality that you can reuse. Your task is to discover the interface of an Objectmon gym, as well as some of the other objects that we will be building off of the rest of the semester.
You are supplied with a library called battle-arena-lib-project02.jar. This library contains the building blocks of this project, and you are free (and encouraged) to reuse as the functionality it contains. Refer back to the Project 1 document for how to modify your build.gradle file to make use of libraries. Hint: it’s the stuff you added in the “dependencies” block, and you will need to put battle-arena-lib-project02.jar into the deps directory as well.
2 Project Requirements
You must create a new Gradle application project, named “project02,” and using the package “cs203.project02”. Your Gradle project will include two classes:
1. App.java which contains your main method.
2. TrainingGym.java which extends AbstractGym.
The majority of work will be in TrainingGym, which must implement all abstract methods in AbstractGym. We will discuss abstract classes and methods later in class, but in a nutshell, an abstract class cannot be directly instantiated and can have abstract methods as well as regular methods. abstract methods are just an interface. I.e., they are just the signature of the method, with no implementation. Instead, they must be implemented by a concrete subclass to be used. The Javadocs will indicate which methods in AbstractGym are abstract, but the compiler will also let you know if you have missed any.
1
Hint: configureFight() is likely the most complicated method. It should ask the user to input, at minimum, values for the number of Objectmon per team and the maximum number of rounds (turns) the battle should have.1 The most straight forward way to do this is via a Scanner object. Check the official Javadocs and slides in the class to see how Scanner works.
Hint: Carefully look at the Javadocs for supplied to you for this project. It might seem like there is a lot for you to do, but the majority of functionality is already present; you just need to call existing methods. My solution is less than 100 lines, including white space.
Hint: You might want to add some helper methods in your AbstractGym class. For example, I have a helper method called createRandomTeams(int numObjectmonPerTeam) that randomly generates Objectmon and adds them to the teams. Remember: try to minimize the amount of work any single method does; this will make it easier for you to reuse functionality later on.
3 Project Deliverables
You will submit a zip file to Canvas. Note that only files of type zip will be accepted: if you submit any other type of file, you will receive a zero on the project.
Your zip file should contain the following:
1. Your Gradle project (be sure to run ./gradlew clean to get read of any compiled files).
2. A file named README (add it in the top level directory of your Gradle project) that includes the following statement along with your name and BlazerId:
“I [YOUR NAME] with BlazerID [YOUR BLAZERID] completed this project on my own, with no external help or information except the official Javadocs, official class textbook, class lectures, instructor, or TAs.
I understand that any use of non-sanctioned materials (e.g., stack overflow, etc.) is considered cheating and will result in a zero for this project, as well as reporting to the department, college, and university for further actions.”
4 Grading
Your main method is worth 2 points. The remaining 48 points are split evenly between the abstract methods you must implement.
1This method has side effects, but that’s ok for this project :).
2
5 Getting Help
COME TO OFFICE HOURS. DO IT. SERIOUSLY!
6 Extra Credit
There is one extra credit point on the project available for each of the following:
• Allow the user to enter the name of each Objectmon on each team.
• Allow the user to enter the hp for each Objectmon on each team.
• Allow the user to enter the stamina for each Objectmon on each team.
• Allow the user to enter the weight for each Objectmon on each team.
• Once a fight has ended, allow the user to choose to configure and start a new fight.
There are five extra credit points if you create unit tests for all the methods your TrainingGym implements. Creating this unit tests will almost certainly involve a deeper dive into the Javadocs.
6.1 Bug Bounty
If you believe that you have discovered a bug, design flaw, or inadequate documentation in the library supplied to you, bring it to Jeremy’s attention. If the bug can be reproduced, or Jeremy agrees with your take on the design flaw/documentation issue, extra credit will be given. The exact amount will be entirely at Jeremy’s discretion, but he is pretty generous with these sort of things 🙂
3