help please!!!! need soon as possible!! Netbeans Integrated Development Environm
ID: 3730008 • Letter: H
Question
help please!!!! need soon as possible!! Netbeans Integrated Development Environment (IDE) UML should be in Word Document
Project Requirements
Each User Defined Class must be in its own separate source text file. The source file name must be the same name as the class name in the source code. The NetBean IDE will assist you in creating separate class files using the File - New File Option from the pull down menu. Do not place more than one class description/ definition code in a single text file unless it is an inner class. The name of the class source file must be same name as the class.
Create a Class named Person
The first part of the assignment is to create a Super Class named Person. Create a basic UML Diagram for the Class named Person. After creating the Class Diagram, implement Class and the methods of your class from the Class Diagram using NetBeans. Requirements for the Person Class A Person has a first name, last name, and social security number. The class should contain the basic functionality of a user defined object described in Chapters 8. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method.
Create a Class named Employee
The next segment of the assignment is to create a basic UML Diagram for an Employee Class and to create and implement the class for the Employee. First create the UML Class Diagram. After creating the Class Diagram, create and implement the Class and the methods of your Employee class from the UML Class Diagram. The Employee class should inherit from the Person class by extending it. Requirements for the Employee Class Create a class named Employee. An Employee has a hire date and an employee type. The Employee class should contain the basic functionality of a user defined object described in Chapters 8 of the textbook. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method.
Create a class named Pilot
The next part of the assignment is to create a basic UML Diagram for a Pilot class. After creating the Class Diagram, implement the methods of your Pilot class. The Pilot class has two properties, the license and rating properties Requirements for the Pilot Class The Pilot class should contain the basic functionality of a user defined object described in Chapters 8 of the textbook. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method. The Pilot Class should inherit from Employee.
Create a class named Mechanic
The next part of the assignment is to create a basic UML Diagram for a Mechanic class. After creating the Class Diagram, implement the methods of your Mechanic class. The Mechanic class has two properties, the title and certification properties. Requirements for the Mechanic Class The Mechanic class should contain the basic functionality of a user defined object described in Chapters 8 of the textbook. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method. The Mechanic Class should inherit from Employee.
Create a class named Accountant
The next part of the assignment is to create a basic UML Diagram for an Accountant class. After creating the Class Diagram, implement the methods of your Accountant class. The Accountant class has two property, the CPA Date and Title Properties. Requirements for the Accountant Class The Accountant class should contain the basic functionality of a user defined object described in Chapters 8 of the textbook. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method. The Accountant Class should inherit from Person.
Create a class named Dependent
The next part of the assignment is to create a basic UML Diagram for a Dependent class. After creating the Dependent Class Diagram, implement the methods of your Dependent class. The Dependent class has three property, the first name, last name, and relation properties. Requirements for the Dependent Class The Dependent class should contain the basic functionality of a user defined object described in Chapters 8 of the textbook. The basic functionality described in chapter 8 is that all user defined objects should have a get and set method for each property. A user defined object should have a default constructor and initialization constructor. A user defined object should have an overriding toString method. The Dependent Class should be a Composite Object in the Student Class as a property. Additionally for this class, it should contain the basic functionality that all user defined classes should have described and illustrated in Chapter 9. The basic functionality described is that every user defined class should also have a compareTo method and a method overrides the equals method inherited from the parent object. Instantiate some instances of Pilot, Mechanic, Accountant, and Dependent Classes. Use your initialization constructor to give each instance an initial state. Use your default constructor to give an instance a default state. After giving an instance a default state, use your set methods to change the state of an object. Use the (to String) method of your Classes to print out the state of the instances of the Classes that were created in memory
Explanation / Answer
package January;
// Class MyDate definition
class MyDate
{
// Instance variable to store data
int date;
int month;
int year;
// Default constructor
MyDate()
{
date = month = year;
}// End of default constructor
// Parameterized constructor
MyDate(int d, int m, int y)
{
date = d;
month = m;
year = y;
}// End of parameterized constructor
// Method to set date
void setDate(int d)
{
date = d;
}// End of method
// Method to set month
void setMonth(int m)
{
month = m;
}// End of method
// Method to set year
void setYear(int y)
{
year = y;
}// End of method
// Method to return date
int getDate()
{
return date;
}// End of method
// Method to return month
int getMonth()
{
return month;
}// End of method
// Method to return year
int getYear()
{
return year;
}// End of method
// Overrides toString() method
public String toStrint()
{
return getDate() + "/" + getMonth() + "/" + getYear();
}// End of method
}// End of class
// Class Person definition
class Person
{
// Instance variable to store data
String firstName;
String lastName;
String ssn;
// Default constructor
Person()
{
firstName = lastName = ssn = "";
}// End of default constructor
// Parameterized constructor
Person(String fn, String ln, String sn)
{
firstName = fn;
lastName = ln;
ssn = sn;
}// End of parameterized constructor
// Method to set first name
void setFirstName(String fn)
{
firstName = fn;
}// End of method
// Method to set last name
void setLastName(String ln)
{
lastName = ln;
}// End of method
// Method to set ssn
void setSsn(String sn)
{
ssn = sn;
}// End of method
// Method to return first name
String getFirstName()
{
return firstName;
}// End of method
// Method to return last name
String getLastName()
{
return lastName;
}// End of method
// Method to return ssn
String getSsn()
{
return ssn;
}// End of method
// Overrides toString() method
public String toString()
{
return " First Name: " + getFirstName() + " Last Name: " + getLastName() + " SSN: " + getSsn();
}// End of method
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Person))
return false;
// typecast o to Complex so that we can compare data members
Person c = (Person) o;
// Compare the data members and return accordingly
return compareTo(ssn, c.ssn) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}// End of class
// Class Employee derived from Person
class Employee extends Person
{
// Instance variable to store data
MyDate hireDate;
String employeeType;
// Default constructor
Employee()
{
hireDate = null;
employeeType = "";
}// End of default constructor
// Parameterized constructor
Employee(String fn, String ln, String sn, MyDate hd, String type)
{
super(fn, ln, sn);
hireDate = hd;
employeeType = type;
}// End of parameterized constructor
// Method to set date
void setDate(MyDate hd)
{
hireDate = hd;
}// End of method
// Method to set type
void setEmployeeType(String et)
{
employeeType = et;
}// End of method
// Method to return date
MyDate getDate()
{
return hireDate;
}// End of method
// Method to return type
String getEmployeeType()
{
return employeeType;
}// End of method
// Overrides toString() method
public String toString()
{
return super.toString() + " Hire Date: " + hireDate.toStrint() + " Employee Type: " + getEmployeeType();
}
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Employee))
return false;
// typecast o to Complex so that we can compare data members
Employee c = (Employee) o;
// Compare the data members and return accordingly
return compareTo(ssn, c.ssn) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}// End of class
// Class Pilot derived from Employee
class Pilot extends Employee
{
// Instance variable to store data
int license;
int rating;
// Default constructor
Pilot()
{
license = rating = 0;
}// End of default constructor
// Parameterized constructor
Pilot(String fn, String ln, String sn, MyDate hd, String type, int li, int ra)
{
super(fn, ln, sn, hd, type);
license = li;
rating = ra;
}// End of parameterized constructor
// Method to set license
void setLicense(int li)
{
license = li;
}// End of method
// Method to set rating
void setRating(int ra)
{
rating = ra;
}// End of method
// Method to return license
int getLicense()
{
return license;
}// End of method
// Method to return rating
int getRating()
{
return rating;
}// End of method
// Overrides toString() method
public String toString()
{
return super.toString() + " License No: " + getLicense() + " Rating: " + getRating();
}// End of method
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Person))
return false;
// typecast o to Complex so that we can compare data members
Pilot c = (Pilot) o;
// Compare the data members and return accordingly
return compareTo(ssn, c.ssn) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}
// Class Mechanic derived from Employee
class Mechanic extends Employee
{
// Instance variable to store data
String title;
String certification;
// Default constructor
Mechanic()
{
title = certification = "";
}// End of default constructor
// Parameterized constructor
Mechanic(String fn, String ln, String sn, MyDate hd, String type, String ti, String ce)
{
super(fn, ln, sn, hd, type);
title = ti;
certification = ce;
}// End of parameterized constructor
// Method to set title
void setTitle(String ti)
{
title = ti;
}// End of method
// Method to set certification
void setCertification(String ce)
{
certification = ce;
}// End of method
// Method to return title
String getTitle()
{
return title;
}// End of method
// Method to return certification
String getCertification()
{
return certification;
}// End of method
// Overrides toString() method
public String toString()
{
return super.toString() + " Title: " + getTitle() + " Certification: " + getCertification();
}// End of method
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Person))
return false;
// typecast o to Complex so that we can compare data members
Mechanic c = (Mechanic) o;
// Compare the data members and return accordingly
return compareTo(ssn, c.ssn) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}// End of class
//Class Account derived from Person
class Accountant extends Person
{
// Instance variable to store data
MyDate CPADate;
String title;
// Default constructor
Accountant()
{
CPADate = null;
title = "";
}// End of default constructor
// Parameterized constructor
Accountant(String fn, String ln, String sn, MyDate cp, String ti)
{
super(fn, ln, sn);
CPADate = cp;
title = ti;
}// End of parameterized constructor
// Method to set CPA date
void setCPADate(MyDate cp)
{
CPADate = cp;
}// End of method
// Method to set title
void setTitle(String ti)
{
title = ti;
}// End of method
// Method to return CPA date
MyDate getCPADate()
{
return CPADate;
}// End of method
// Method to return title
String getTitle()
{
return title;
}// End of method
// Overrides toString() method
public String toString()
{
return super.toString() + " CAP Date: " + CPADate.toStrint() + " Title: " + getTitle();
}// End of method
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Person))
return false;
// typecast o to Complex so that we can compare data members
Accountant c = (Accountant) o;
// Compare the data members and return accordingly
return compareTo(ssn, c.ssn) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}// End of class
// Class Dependent definition
class Dependent
{
// Instance variable to store data
String firstName;
String lastName;
String relation;
// Default constructor
Dependent()
{
firstName = lastName = relation = "";
}// End of default constructor
// Parameterized constructor
Dependent(String fn, String ln, String re)
{
firstName = fn;
lastName = ln;
relation = re;
}// End of parameterized constructor
// Method to set first name
void setFirstName(String fn)
{
firstName = fn;
}// End of method
// Method to set last name
void setLastName(String ln)
{
lastName = ln;
}// End of method
// Method to set relation
void setRelation(String re)
{
relation = re;
}// End of method
// Method to return first name
String getFirstName()
{
return firstName;
}// End of method
// Method to return last name
String getLastName()
{
return lastName;
}// End of method
// Method to return relation
String getRelation()
{
return relation;
}// End of method
// Overrides toString() method
public String toString()
{
return " First Name: " + getFirstName() + " LastName: " + getLastName() + " Relation: " + getRelation();
}// End of method
// Overriding equals() to compare two Person
public boolean equals(Object o)
{
// If the object is compared with itself then return true
if (o == this)
return true;
// Check if o is an instance of Complex or not "null instanceof [type]" also returns false
if (!(o instanceof Person))
return false;
// typecast o to Complex so that we can compare data members
Dependent c = (Dependent) o;
// Compare the data members and return accordingly
return compareTo(firstName, c.firstName) == 0;
}// End of method
// Overrides compareTo method
public int compareTo(String one, String two)
{
// Checks if first parameter one is equals to second parameter two then return zero
if(one.compareTo(two) == 0)
return 0;
// Otherwise return one
else
return 1;
}// End of method
}// End of class
// Driver class Student definition
public class Student
{
// main function definition
public static void main(String[] args)
{
// Creates objects of MyDate class using parameterized constructor
MyDate da1 = new MyDate(12, 3, 2017);
MyDate da2 = new MyDate(27, 6, 2010);
// Creates objects of Pilot class using parameterized constructor
Pilot p1 = new Pilot("Pyari", "Sahu", "111", da1, "Pilot", 123321, 3);
Pilot p2 = new Pilot("Ram", "Panda", "222", da2, "Pilot", 333322, 2);
Pilot p3 = new Pilot("Sita", "Kar", "333", da1, "Pilot", 443321, 1);
// Creates objects of Mechanic class using parameterized constructor
Mechanic m1 = new Mechanic("Anil", "Sharma", "444", da1, "Mechanic", "Padhi", "CAD");
Mechanic m2 = new Mechanic("Amit", "Kaur", "555", da2, "Mechanic", "Punit", "CAM");
Mechanic m3 = new Mechanic("Sankar", "Pandit", "666", da2, "Mechanic", "Ranbi", "CAD");
// Creates objects of Accountant class using parameterized constructor
Accountant a1 = new Accountant("Binod", "Sahu", "777", da1, "Finance");
Accountant a2 = new Accountant("Satya", "Panda", "888", da2, "SC");
Accountant a3 = new Accountant("Sanjiv", "Hota", "999", da2, "MN");
// Creates objects of Dependent class using parameterized constructor
Dependent d1 = new Dependent("Binod", "Sahu", "Father");
Dependent d2 = new Dependent("Mohan", "Sahu", "Uncle");
Dependent d3 = new Dependent("Rajiv", "Gupta", "Aunty");
System.out.println(p1);
System.out.println(p2);
System.out.println(p3);
System.out.println(m1);
System.out.println(m2);
System.out.println(m3);
System.out.println(a1);
System.out.println(a2);
System.out.println(a3);
System.out.println(d1);
System.out.println(d2);
System.out.println(d3);
System.out.println("Pilot - 1 equals to Pilot - 2 " + p1.equals(p2));
System.out.println("Pilot - 1 equals to Pilot - 1 " + p1.equals(p1));
System.out.println("Mechanic - 1 equals to Mechanic - 3 " + m1.equals(m3));
System.out.println("Mechanic - 2 equals to Mechanic - 2 " + m2.equals(m2));
System.out.println("Accountant - 2 equals to Accountant - 3 " + m2.equals(m3));
System.out.println("Accountant - 3 equals to Accountant - 3 " + m3.equals(m3));
System.out.println("Dependent - 3 equals to Dependent - 3 " + m3.equals(m3));
System.out.println("Dependent - 2 equals to Dependent - 1 " + m2.equals(m1));
}// End of main method
}// End of driver class
Sample Output:
First Name: Pyari
Last Name: Sahu
SSN: 111
Hire Date: 12/3/2017
Employee Type: Pilot
License No: 123321
Rating: 3
First Name: Ram
Last Name: Panda
SSN: 222
Hire Date: 27/6/2010
Employee Type: Pilot
License No: 333322
Rating: 2
First Name: Sita
Last Name: Kar
SSN: 333
Hire Date: 12/3/2017
Employee Type: Pilot
License No: 443321
Rating: 1
First Name: Anil
Last Name: Sharma
SSN: 444
Hire Date: 12/3/2017
Employee Type: Mechanic
Title: Padhi
Certification: CAD
First Name: Amit
Last Name: Kaur
SSN: 555
Hire Date: 27/6/2010
Employee Type: Mechanic
Title: Punit
Certification: CAM
First Name: Sankar
Last Name: Pandit
SSN: 666
Hire Date: 27/6/2010
Employee Type: Mechanic
Title: Ranbi
Certification: CAD
First Name: Binod
Last Name: Sahu
SSN: 777
CAP Date: 12/3/2017
Title: Finance
First Name: Satya
Last Name: Panda
SSN: 888
CAP Date: 27/6/2010
Title: SC
First Name: Sanjiv
Last Name: Hota
SSN: 999
CAP Date: 27/6/2010
Title: MN
First Name: Binod
LastName: Sahu
Relation: Father
First Name: Mohan
LastName: Sahu
Relation: Uncle
First Name: Rajiv
LastName: Gupta
Relation: Aunty
Pilot - 1 equals to Pilot - 2 false
Pilot - 1 equals to Pilot - 1 true
Mechanic - 1 equals to Mechanic - 3 false
Mechanic - 2 equals to Mechanic - 2 true
Accountant - 2 equals to Accountant - 3 false
Accountant - 3 equals to Accountant - 3 true
Dependent - 3 equals to Dependent - 3 true
Dependent - 2 equals to Dependent - 1 false
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.