Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part I is completed, need help with Part 2 please Person.java code: import java.util.Date; public class Person { // fields of class private String ID

image text in transcribed

Part I is completed, need help with Part 2 please

Person.java code:

import java.util.Date; public class Person { // fields of class private String ID ; private String firstName ; private String lastName ; private String title ; private int YOB ; // constructor public Person(String iD, String firstName, String lastName, String title, int yOB) { ID = iD; this.firstName = firstName; this.lastName = lastName; this.title = title; // validating YOB if (yOB >= 1900 && yOB = 1900 && yOB  

PersonGenerator.java code:

import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class PersonGenerator { public static void main(String aa[]) throws IOException { FileWriter fw = new FileWriter("D:\\Person.csv"); ArrayList al = new ArrayList(); // ArrayList declaration int n; Scanner ss = new Scanner(System.in); // Scanner to get input System.out.println("Enter number of persons"); n = ss.nextInt(); // get n from user for (int i = 0; i  

Part 1: Person Generator: 1 Create a person.java class to represent a Person Object. Person Fields String ID; String first Name; String lastName; String title; Mr., Mrs., Ms., Prof., Dr., Hon., ... int Yos; - Year of Birth - Range should be 1900-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 to get current Year (may requires a bit of web search) - 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) public String tocs DataRecord) 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 Use the string.forator system.out.printf method to create a neatly formatted columnar display of the data ID Firstrane Lastnante Title YOB seal John Doc Mr. 1992 Bea2 Jane Doc Mrs. 1993

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago