ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 1 of 7 DUE DATE: FEB 7TH, 2020 AT 11:59PM Instructions: • Read the SubmissionProcedures.PDF and the Standards.java carefully BEFORE you start. • Let...

1 answer below »
just complete the assignment do not need git.


ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 1 of 7 DUE DATE: FEB 7TH, 2020 AT 11:59PM Instructions: • Read the SubmissionProcedures.PDF and the Standards.java carefully BEFORE you start. • Let me know about any typos, clarifications or questions you may have right away. Don’t wait. • Read the whole assignment before you start. • Start right away. The sooner you get stuck, the sooner you can get help to get un-stuck. Assignment overview Learning outcomes: You will use custom instance objects as data types to store information, become familiar with static and instance variables and methods, and learn many of the basic skills you will need to successfully develop software. This will likely be the largest single piece of software many of you have written and managing that complexity is part of the challenge. Be sure to test your methods as you go and comment well. Additional Notes: Read Standards.java and SubmissionGuidelines.PDF Carefully & before you start. The classes PartySim.java and RandomGeneration.java class will be provided but will need to be modified. Please provide detailed commenting!!! Assignment Notes Be sure to read the assignment carefully. Include a readme.txt document that specifies the latest commit that will compile and run. I will NOT mark your assignment without the git repo included so do not "forget" to do it. This assignment is as much about using git, learning good formatting, commenting, testing and refactoring practices as it is about Java. Do not skip steps. Also, I am aware not all the methods you create are directly used in this assignment. You still need to create and test them, we will use them in the future. You also may want to make backups if you are unsure about git. You can take the whole folder (.git file included) and put it in a .zip file if you are worried about breaking things. Git Tips: • Do not commit any file that should not be there. It is harder to remove files that have been added then to not add them in the first place. The commit is meant to be a reflective phase where you review your work. You CANNOT UNDO a commit and anything that gets put in will be in the record forever. • The append option on a commit will allow you to revise or add additional files to the LAST commit you made, after that it is in the permanent record. • Each git commit should include the Phase and a clear and complete summary of what code was added. • If you find a bug, include that bug as its own commit. You should include the specific error (eg. Null reference) and how you fixed it. This will be a useful reference when you encounter the same error again. • You may need to enable hidden files in your Windows/Mac file explorer in order to see the .git and .gitignore files. ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 2 of 7 Tips: Start early. Read the assignment fully before beginning. We will go through it in the first class after it has been handed out. That is your chance to ask questions Seriously, start early. I know you are busy but it is much easier if you get stuck early and can get help troubleshooting. Notes on Academic Misconduct: Your code should be done entirely by you. Any suspicion of Academic Misconduct or plagiarism will be fully investigated and can lead to serious academic penalties including 0 on the assignment for a first office, or an F in the course. Third offences could lead to expulsion from ICM. If you have any questions as to what qualifies as Academic Misconduct, please discuss it with me. Things that are considered Academic Misconduct include: • Copying code from old assignments • Copying code from classmates or other people • Telling or being told the specific steps required to solve a problem • Copying code off the internet. What you are allowed to do: • Discuss examples given as handouts, from the textbook or class notes with others. • Get together to study and help each other with basic understanding of concepts (eg. What is an object). • I am considering Git to be a tool you are using, so feel free to help each other with usage of SourceTree and git. Phase 0: When you first start your project, before writing any code, you will create a new git repo in the same folder. You should ignore any .class files, or any files associated with your text editor (basically ignore every file type that appears other then .java or .txt) Create a new local git repo, then make your first commit here, which will simply be the .gitignore file that was created with a message (such as "Initial commit" with a list of the types of files ignored. Phase 1: Basic Objects Create the following Object class files: Place.java Person.java Thing.java For now, these will all have the same structure with a String name and String description. We will customize them later. Each class should have a toString() method that returns the name and a constructor that sets both variables. Make your second commit here. It should include a descriptive and clear message. ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 3 of 7 Phase 1b: Refactor and comment your code. Fix any typos, ensure the indentation is neat and add commenting. Each variable, method and class should each have a description of what it is for. This description should be CLEAR and provide helpful context, usage notes or anything else that could be helpful later. It should NOT be the assignment requirements pasted in. Write it yourself and put some thought into it. Make your third commit, detailing how you improved your code in the last step. Again, an appropriate message should be included. Phase 1c. Add accessor and mutator methods. More commenting. Add a getDescription accessor method that simply returns the description. You should also have a setDescription method in each class that has a void return type and accepts a String newDescription. This method will replace the current description with newDescription. Test the classes out by creating your own TestClass.java class to create Objects of each type and calling all the methods. Double check the spelling and case (methods are lowercase, classes are Uppercase) against the assignment doc. Create a text file that includes your test output (call it test_output.txt or something equally obvious) and commit that along with your test class itself. Phase 2: PersonList class Since you are going to have many arrays of type Person objects, we can leverage the power of Objects by creating a PersonList class to manage groups of people. This will simply be a class that has the purpose of containing a private array of type Person. You will create methods that allow you to manipulate this array more easily. eg. Place will contain multiple Persons, while each Person will also contain a list of other Persons. Create the following methods in the PersonList class. A constructor, accepting no parameters The PersonList constructor will create the array object itself. For now, it will contain only null values. Choose some sufficiently high number (say 100 for now) as the length of the array. You will also add an instance variable to the class of type int that will keep track of the current number of Person objects the array is holding. Note that this is not the same as the length of the array, and this counter should be used to avoid accessing null values in the array. public void addPerson(Person newPerson) Add a new Person in the next open spot of the array (ie if there are two Persons in index 0 and index 1, you will add the new Person at index 2). It should also update the counter (so you know how many Person objects there are). public int size() Return the current number of Person objects currently stored in the array (not the length). ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 4 of 7 public String toString() Return a single String value that includes all of the names of the Person objects stored in the list with the format. You should remove the last comma as well, just don't add any additional bugs while you do it. Specifically watch for errors when your list is either empty or contains only one Person. [Name1, Name2, Name3] At this point, you should compile and test your work. When you are satisfied that it is working, commit your PersonList class, your updated test file, and add the output generated to your test_output.txt file (don't erase the old stuff, and make sure its clear which phase each is from.) You should test it by creating some Person objects, creating a PersonList, then adding the Person objects to the PersonList, checking that the size is correct, then outputting the list as a String. Some other things to check for: Does your toString method work for size 0 and size 1 lists? Don't worry about filling up the array yet, we will deal with that later. Phase 2b: Continuing with your PersonList class
Answered Same DayJan 29, 2021

Answer To: ASSIGNMENT 1: Party Sim COMP 1020 Winter 2020 Page 1 of 7 DUE DATE: FEB 7TH, 2020 AT 11:59PM...

Arun Shankar answered on Jan 31 2021
150 Votes
PartySim/.classpath

    
        
            
        
    
    
    
PartySim/.project

     PartySim
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
PartySim/bin/PartySim.class
public synchronized class PartySim {
public void PartySim();
publ
ic static void main(String[]);
private void mingle(Place);
private String wholePartyToString(PersonList);
public static PersonList createPeople(int);
}
PartySim/bin/Person.class
public synchronized class Person {
String name;
String description;
PersonList talkedTo;
void Person(String, String);
void Person();
public String toString();
public String getDescription();
public String getName();
public PersonList getTalkedToList();
public void addToTalkedToList(Person);
public void clearTalkedToList();
public void setDescription(String);
}
PartySim/bin/PersonList.class
public synchronized class PersonList {
private Person[] arr;
int counter;
void PersonList();
public void addPerson(Person);
public int size();
public String toString();
private int findIndex(Person);
boolean containsPerson(Person);
Person removePerson(Person);
Person getPersonByIndex(int);
}
PartySim/bin/Place.class
public synchronized class Place {
String name;
String description;
private PersonList people;
void Place(String, String);
public String toString();
public String getDescription();
public String getName();
public Person getPersonByIndex(int);
public PersonList getPersonsAtParty();
public void setDescription(String);
public String getPeople();
public void addPerson(Person);
public boolean removePerson(Person);
public int countPeople();
public boolean contains(Person);
}
PartySim/bin/RandomGenerator.class
public synchronized class RandomGenerator {
private static String[] locationAdjectives;
private static String[] locationNouns;
private static String[] randomNames;
private static String[] itemAdjectives;
private static String[] itemNouns;
private static String[] creatureDifficulty;
private static String[] creatureNames;
private static String[] verbs;
private static String[] nouns;
static void ();
public void RandomGenerator();
public static String getCreatureNameByDifficulty(int);
public static String getRandomItemName();
public static String getRandomName();
public static String getRandomLocationName();
public static String getRandomPersonDescription();
public static int randomRoll(int, int);
}
PartySim/bin/TestClass.class
public synchronized class TestClass {
public void TestClass();
public static void main(String[]);
}
PartySim/bin/Thing.class
public synchronized class Thing {
String name;
String description;
void Thing(String, String);
public String toString();
public String getDescription();
public String getName();
public void...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here