Skip to content

IT2045C/Assignment-Get-Classy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignment 2: Get Classy

Assignment Self Assessment:

Reflection

Self Assessment

Part 1:
  • The program runs with no errors.
  • The Person class includes all the fields and methods specified above.
  • Usage of the Calendar object to calculate age in the getAge method.
  • The program properly instantiates objects using the class constructor.
  • The program properly stores the Objects in an ArrayList.
  • Proper usage of Git and GitHub (frequent commits, explanatory commit messages)
Part 2:
  • The program runs with no errors.
  • The program properly uses the JFileChooser.
  • The program properly instantiates objects using the class constructor.
  • The program properly stores the Objects in an ArrayList.
  • The program output is formatted properly.
  • Proper usage of Git and GitHub (frequent commits, explanatory commit messages)

Your Grade: /20

Notes:


Lab Goals

  1. Practice creating classes and instantiating objects.
  2. Instantiate object using data from a text file.
  3. Persist Object data to a text file.
  4. Store and Manipulate class objects with an ArrayList

Final Result:

You will be submitting a git repository with the following naming convention, 2-get-classy-<your-github-username>, (i.e., 2-get-classy-Ygilany). The repository contains:

  1. one Java Project with the following files:
  2. Person.java (a class to represent a person object)
  3. PersonGenerator.java (has a main method)
  4. PersonReader.java (has a main method)
  5. SafeInput.java (The source file is available with the assignment instructions)
  6. The output text file from the PersonGenerator program.
  7. a modified README.md file that includes your self-assessment

Part 1: Writing to a text file:

  1. Create a Person.java class to represent a Person Object.
Person
Fields
String ID;
String firstName;
String lastName;
String title; Mr., Mrs., Ms., Prof., Dr., Hon., ...
int YOB; - Year of Birth
- Range should be 1940-2010
- make sure validations happen in the constructor as well as the setter method.
Methods
Constructor
Getters and Setters
public String fullName() returns a concatenation of the first and last names
public String formalName() returns a concatenation of the title and the full name
public static int getAge(int year) - A static method that takes a year and returns an age.
- Use the Calendar Object (Requires a bit of web search)
public String toCSVDataRecord() - returns a comma separated value (csv) String suitable to writing to a java text file.
- Make sure to use this function when saving data to the file.
- (i.e., 0001,John, Doe,Mr., 2000)
  1. Create a program (Java main class) called PersonGenerator.java.
  • a user will input the data to the console.
  • a Person object is created for each entry.
  • Store all the Person objects in an ArrayList<Person>
  • Export all the Person objects to a text file using the toCSVDataRecord() method

Grading

  • The program runs with no errors.
  • The Person class includes all the fields and methods specified above.
  • Usage of the Calendar object to calculate age in the getAge method.
  • The program properly instantiates objects using the class constructor.
  • The program properly stores the Objects in an ArrayList.
  • Proper usage of Git and GitHub (frequent commits, explanatory commit messages)

Part 2: Person Reader:

  1. Create a program (Java main class) called PersonReader.java.
  • Use the JFileChooser to prompt the user to select the file you export in Part 1.
  • Instantiate a Person Object for each record you read from the file.
  • Store all the Person Objects in an ArrayList<Person>.
  • Use the String.format or System.out.printf method to create a neatly formatted columnar display of the data.
ID    Firstname    Lastname   Title    YOB
==================================================
0001  John         Doe        Mr.      1990
0002  Jane         Doe        Mrs.     1993

Grading

  • The program runs with no errors.
  • The program properly uses the JFileChooser.
  • The program properly instantiates objects using the class constructor.
  • The program properly stores the Objects in an ArrayList.
  • The program output is formatted properly.
  • Proper usage of Git and GitHub (frequent commits, explanatory commit messages)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages