Placeholder

CSIS 312 Assignment 2 Employee Class

$19.00

Description

In chapter 9 of your Deitel & Deitel text, you studied an inheritance hierarchy in which class BasePlusCommissionEmployee inherited from class CommissionEmployee. However, not all types of employees are CommissionEmployees.
In this exercise, you’ll create a more general Employee superclass that factors out the attributes and behaviors in class CommissionEmployee that are common to all Employees. The common attributes and behaviors for all Employees are firstName, lastName, socialSecurityNumber, getFirstName, getLastName, getSocialSecurityNumber and a portion of method toString.
Create a new superclass Employee that contains these instance variables and methods and a constructor.
Next, rewrite class CommissionEmployee from Section 9.4.5 as a subclass of Employee. Class CommissionEmployee should contain only the instance variables and methods that are not declared in superclass Employee. Class CommissionEmployee’s constructor should invoke class Employee’s constructor and CommissionEmployee’s toString method should invoke Employee’s toString method.
Once you’ve completed these modifications, run the BasePlusCommissionEmployeeTest app using these new classes to ensure that the app still displays the same results for a BasePlusCommissionEmployee object.
Make sure that your screen shots show your program running and that your runtime display shows that your program does all that is required of it. You only get credit for what you demonstrate.
Submit this assignment by 11:59 p.m. (ET) on Monday of Module/Week 2.
SCREENSHOTS
SOLUTION
PAYMENT
CSIS 312 Assignment 2 Screenshot
CSIS 312 Assignment 2 Screenshot
CSIS 312 Assignment 2 Screenshot
The solution consists of:
A report word document for this assignment
All Java programs and classes
A Netbeans project in case you want to run the project on your computer.
Screenshots showing program running
Attachments [Move over files to preview content of those files]
CSIS_312_Assignment_2.zip (301.14 KB)
classes
BasePlusCommissionEmployee.class
BasePlusCommissionEmployeeTest.class
CommissionEmployee.class
Employee.class
CSIS312 Assignment 2 Report.docx
Netbeans project
CSIS312Assignment2
pom.xml
src
main
java
BasePlusCommissionEmployee.java
BasePlusCommissionEmployeeTest.java
CommissionEmployee.java
Employee.java
target
classes
.netbeans_automatic_build
BasePlusCommissionEmployee.class
BasePlusCommissionEmployeeTest.class
CommissionEmployee.class
Employee.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
screenshots
CSIS312-Assignment-2-Screenshot-2.png
CSIS312-Assignment-2-Screenshot-3.png
CSIS312-Assignment-2-Screenshot.png
source code
BasePlusCommissionEmployee.java
BasePlusCommissionEmployeeTest.java
CommissionEmployee.java
Employee.java
Preview BasePlusCommissionEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx(xxxxxx xxxxxxxxx, xxxxxx xxxxxxxx,
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx,
xxxxxx xxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx,
grossSales, commissionRate);
// if baseSalary is invalid throw exception if (baseSalary < 0.0) throw new IllegalArgumentException( "Base salary must be >= 0.0″);
this.baseSalary = baseSalary; }
// set base salary public void setBaseSalary(double baseSalary)
{
xx (xxxxxxxxxx < 0.0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "xxxx xxxxxx xxxx xx >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
Preview BasePlusCommissionEmployeeTest.java
// xxx xxxxxxxxxx xxxxxxxx xxxx
xxxxxx.xxx.xxxxxxx(
“xxxxxxxx xxxxxxxxxxx xxxxxxxx xx xxx xxxxxxx:”);
xxxxxx.xxx.xxxxxx(“%x%x %x%x”, “xxxxx xxxx xx”,
employee1.getFirstName()); System.out.printf(“%s %s%n”, “Last name is”, employee1.getLastName()); System.out.printf(“%s %s%n”, “Social security number is”, employee1.getSocialSecurityNumber()); System.out.printf(“%s %.2f%n”, “Gross sales is”, employee1.getGrossSales()); System.out.printf(“%s %.2f%n”, “Commission rate is”, employee1.getCommissionRate());
employee1.setGrossSales(5000); employee1.setCommissionRate(.1);
xxxxxx.xxx.xxxxxx(“%x%x:%x%x%x%x”,
“xxxxxxx xxxxxxxx xxxxxxxxxxx xxxxxxxx xx xxxxxxxx”, xxxxxxxx1);
// xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx2 =
Preview CommissionEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx,
xxxxxx xxxxxxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
// implicit call to Object constructor occurs here
// if grossSales is invalid throw exception if (grossSales < 0.0) throw new IllegalArgumentException( "Gross sales must be >= 0.0″);
// if commissionRate is invalid throw exception if (commissionRate <= 0.0 || commissionRate >= 1.0) throw new IllegalArgumentException( “Commission rate must be > 0.0 and < 1.0"); xxxx.xxxxxxxxxx = xxxxxxxxxx; xxxx.xxxxxxxxxxxxxx = xxxxxxxxxxxxxx; } // xxx xxxxxxxxxxx // xxx xxxxx xxxxx xxxxxx xxxxxx xxxx xxxxxxxxxxxxx(xxxxxx xxxxxxxxxx) Preview Employee.java xxxxxx xxxxx xxxxxxxx { xxxxxxx xxxxxx xxxxxxxxx; xxxxxxx xxxxxx xxxxxxxx; private String socialSecurityNumber; public Employee() { } public Employee(String fName, String lName, String ssNumber) { xxxx.xxxxxxxxx = xxxxx; xxxx.xxxxxxxx = xxxxx; xxxx.xxxxxxxxxxxxxxxxxxxx = xxxxxxxx; } // xxxxxx xxxxx xxxx Preview BasePlusCommissionEmployee.java xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx(xxxxxx xxxxxxxxx, xxxxxx xxxxxxxx, xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx, xxxxxx xxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx) { xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx, grossSales, commissionRate); // if baseSalary is invalid throw exception if (baseSalary < 0.0) throw new IllegalArgumentException( "Base salary must be >= 0.0″);
this.baseSalary = baseSalary; }
// set base salary public void setBaseSalary(double baseSalary)
{
xx (xxxxxxxxxx < 0.0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "xxxx xxxxxx xxxx xx >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
Preview BasePlusCommissionEmployeeTest.java
// xxx xxxxxxxxxx xxxxxxxx xxxx
xxxxxx.xxx.xxxxxxx(
“xxxxxxxx xxxxxxxxxxx xxxxxxxx xx xxx xxxxxxx:”);
xxxxxx.xxx.xxxxxx(“%x%x %x%x”, “xxxxx xxxx xx”,
employee1.getFirstName()); System.out.printf(“%s %s%n”, “Last name is”, employee1.getLastName()); System.out.printf(“%s %s%n”, “Social security number is”, employee1.getSocialSecurityNumber()); System.out.printf(“%s %.2f%n”, “Gross sales is”, employee1.getGrossSales()); System.out.printf(“%s %.2f%n”, “Commission rate is”, employee1.getCommissionRate());
employee1.setGrossSales(5000); employee1.setCommissionRate(.1);
xxxxxx.xxx.xxxxxx(“%x%x:%x%x%x%x”,
“xxxxxxx xxxxxxxx xxxxxxxxxxx xxxxxxxx xx xxxxxxxx”, xxxxxxxx1);
// xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx2 =
Preview CommissionEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx,
xxxxxx xxxxxxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
// implicit call to Object constructor occurs here
// if grossSales is invalid throw exception if (grossSales < 0.0) throw new IllegalArgumentException( "Gross sales must be >= 0.0″);
// if commissionRate is invalid throw exception if (commissionRate <= 0.0 || commissionRate >= 1.0) throw new IllegalArgumentException( “Commission rate must be > 0.0 and < 1.0"); xxxx.xxxxxxxxxx = xxxxxxxxxx; xxxx.xxxxxxxxxxxxxx = xxxxxxxxxxxxxx; } // xxx xxxxxxxxxxx // xxx xxxxx xxxxx xxxxxx xxxxxx xxxx xxxxxxxxxxxxx(xxxxxx xxxxxxxxxx) Preview Employee.java xxxxxx xxxxx xxxxxxxx { xxxxxxx xxxxxx xxxxxxxxx; xxxxxxx xxxxxx xxxxxxxx; private String socialSecurityNumber; public Employee() { } public Employee(String fName, String lName, String ssNumber) { xxxx.xxxxxxxxx = xxxxx; xxxx.xxxxxxxx = xxxxx; xxxx.xxxxxxxxxxxxxxxxxxxx = xxxxxxxx; } // xxxxxx xxxxx xxxx Price: $19 You May Also Like: CSIS 312 Assignment 1 Time2 Class CSIS 312 Entire Course CSIS 312 Assignment 3 Payroll System CSIS 312 Assignment 4 Random Sentences CSIS 312 Assignment 5 LinkedList Object CSIS 312 Assignment 6 printArray and Factorial Calculator CSIS 312 Assignment 7 Pair Class CSIS 312 Assignment 8 Stack Data Structure CSIS 312 Assignment 6 Print Array CSIS 312 Assignment 8 SecureRandom

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.