Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We have started working on an in-class application. I have the required files fo

ID: 672512 • Letter: W

Question

We have started working on an in-class application. I have the required files for this assignment (Employee, Product, ServiceClass and JAVAMART [containing the main() method]). Your task for assignment 1 is to write the functionality for each class as listed below:

Create appropriate packages for all classes (HINT: you may need sub packages); • Create the following classes that will inherit from the Employee class: o FullTimeEmployee; o PartTimeEmployee; o SeasonalEmployee; o Each class will have some unique features to salary/pay calculating methods that differentiate from the super class;

Complete the menu driven code in the main method in the JAVAMART class so it will: o Read user input and create a new employee object. This needs to be added to an ArrayList for storage; o Read user input and create a new product object. This needs to be added to an ArrayList for storage; o Allow for a search of an employee and display the result; o Allow for a search for a product and display the result;

Explanation / Answer

package company;

class Employee

{

int age;

String name, address, gender;

Scanner s=new Scanner(System.in);

Employee()

{

System.out.println("Enter the employee name");

name=s.nextLine();

System.out.println("Enter the gender");

gender=s.nextLine();

System.out.println("Enter the address");

address=s.nextLine();

System.out.println("Enter age");

age=s.nextInt();

}

void display()

{

System.out.println("Employee name:"+name);

System.out.println("Employee age:"+age);

System.out.println("Employee address:"+address);

System.out.println("Employee gender:"+gender);

}

}

package cmp;

class fullTimeEmployee extends Employee

{
float salary;

int des;

fullTimeEmployee()

{

System.out.println("Enter designation");

des=s.nextLine();

System.out.println("Enter salary");

salary=s.nextFloat();

}

void display()

{

System.out.println("FULL TIME EMPLYEE DETAILS");

super.display();

System.out.println("Designation:"+des);

System.out.println("Salary:"+salary);

}

}

package cmp2;

class partTimeEmployee extends Employee

{

int wrknghrs,rate;

partTimeEmployee()

{

System.out.println("Enter no.of hours worked");

wrknghrs=s.nextInt();

}

void calculatePay()

{

rate=8*wrknghrs;

}

void display()

{

System.out.println("PART TIME EMPLOYEE DETAILS");

super.display();

System.out.println("Number of hours worked:"+wrknghrs);

System.out.println("Salary for"+wrknghrs+"working hours is $"+rate);

}

}

package cmp3;

class seasonalEmployee extends Employee

{

int months,rate;

seasonalEmployee()

{

System.out.println("Enter the no.of months worked");

months=s.nextLine();

}

void calculatepay()

[

rate=8*months;

}

void display()

{

System.out.println("SEASONAL EMPLOYEE DETAILS");

super.display();

System.out.println("Number of months worked is:"+months);

System.out.println("Salary for"+months+"months worked is $"+rate);

}

}

class Product

{

public static void meth1()

{

int a,b,p;

System.out.println("Enter a value");

a=s.nextInt();

System.out.println("Enter b value");

b=s.nextInt();

p=a*b;

System.out.println("The product is:" +p);

}

}

import java.company.*;

import java.company.cmp1;

import java.company.cmp2;

import java.company.cmp3;
class JAVAMART

{

public static void main(String args[])

{

List<Employee> employeeList=new ArrayList<Employee>();

List<Product> productList=new ArrayList<Product>();

fullTimeEmployee ft=new fullTimeEmployee();

partTimeEmployee pt=new partTimeEmployee();

seasonalTimeEmployee st=new seasonalTimeEmployee();

Product p=new Product();

ft.display();

pt.calculatePay();

pt.display();

st.calculatePay();

st.display();

p.meth1();

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote