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

School class= texas,Cafeteria food =Pizza, Security=police Highschool=lockers, r

ID: 3759587 • Letter: S

Question

School class= texas,Cafeteria food =Pizza, Security=police

Highschool=lockers, recess

College, tuitions

I need a Java progam using Inheritance Using School as the program.

example: program should include


On the demo please do not hard codind and every class needs to have a method

**Please dont use the joptionpane in java**

This is a exmple program

public class ShiftSupervisorDemo {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

ShiftSupervisor ss=new ShiftSupervisor("John Smith","123-A"," 11-15-2005", 48000, 6500);

System.out.println("Here's the first shift supervisor.");

System.out.println(ss);

ShiftSupervisor ss2 =new ShiftSupervisor();

ss2.setName("Joan Jones");

ss2.setEmployeeNumber("222-L");

ss2.setHireDate( "12-12-2005");

ss2.setSalary(55000);

ss2.setEmployeeNumber("8000");

System.out.println("Here's the Second shift supervisor.");

System.out.println(ss2);

}

}

public class Employee

{

private String name; // Employee name

private String employeeNumber; // Employee number

private String hireDate; // Employee hire date

//This constructor initializes an object with a name, employee number, and hire date.

public Employee(String n, String num, String date)

{

name = n;

setEmployeeNumber(num);

hireDate = date;

}

//The no-arg constructor initializes an object with null strings for name, employee number, and hire date.

public Employee()

{

name = "";

employeeNumber = "";

hireDate = "";

}

//The setName method sets the employee's name.

public void setName(String n)

{

name = n;

}

//The setEmployeeNumber method sets the employee's number.

public void setEmployeeNumber(String e)

{

if (isValidEmpNum(e))

employeeNumber = e;

else

employeeNumber = "";

}

//The setHireDate method sets the employee's hire date.

public void setHireDate(String h)

{

hireDate = h;

}

//The getName method returns the employee's name.

public String getName()

{

return name;

}

//The getEmployeeNumber method returns the employee's number.

public String getEmployeeNumber()

{

return employeeNumber;

}

//The getHireDate method returns the employee's hire date.

public String getHireDate()

{

return hireDate;

}

//isValidEmpNum is a private method that determines whether a string is a valid employee number.

private boolean isValidEmpNum(String e)

{

boolean status = true;

if (e.length() != 5)

status = false;

else

{

if ((!Character.isDigit(e.charAt(0))) ||

(!Character.isDigit(e.charAt(1))) ||

(!Character.isDigit(e.charAt(2))) ||

(e.charAt(3) != '-') ||

(!Character.isLetter(e.charAt(4))))

status = false;

}

return status;

}

//toString method @return A reference to a String representation of the object.

public String toString()

{

String str = "Name: " + name + " Employee Number: ";

if (employeeNumber == "")

str += "INVALID EMPLOYEE NUMBER";

else

str += employeeNumber;

str += (" Hire Date: " + hireDate);

return str;

}

}

import java.text.DecimalFormat;

public class ShiftSupervisor extends Employee

// TODO Auto-generated method stub

{

private double salary;

private double bonus;

public ShiftSupervisor(String n,String num,String date,double sal, double b){

super();

salary= sal;

bonus= b ;

}

public ShiftSupervisor()

{

super();

salary= 0.0;

bonus= 0.0 ;

}

public void setSalary(double s)

{

salary = s;

}

public void setBonus(double b)

{

bonus=b;

}

public double getSalary()

{

return salary;

}

public double getBonus()

{

return bonus;

}

public String toString()

{

DecimalFormat dollar= new DecimalFormat("#,##0.00");

String str=super.toString();

str+=(" Annual Salary: $" + dollar.format(salary));

str+=(" Production Bonus: $" + dollar.format(bonus));

return str;

}

}

Explanation / Answer

public class ShiftSupervisorDemo {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ShiftSupervisor ss=new ShiftSupervisor("John Smith","123-A"," 11-15-2005", 48000, 6500);
System.out.println("Here's the first shift supervisor.");
System.out.println(ss);
ShiftSupervisor ss2 =new ShiftSupervisor();
ss2.setName("Joan Jones");
ss2.setEmployeeNumber("222-L");
ss2.setHireDate( "12-12-2005");
ss2.setSalary(55000);
ss2.setEmployeeNumber("8000");
System.out.println("Here's the Second shift supervisor.");
System.out.println(ss2);
}
}
public class Employee
{
private String name; // Employee name
private String employeeNumber; // Employee number
private String hireDate; // Employee hire date
//This constructor initializes an object with a name, employee number, and hire date.
public Employee(String n, String num, String date)
{
name = n;
setEmployeeNumber(num);
hireDate = date;
}
//The no-arg constructor initializes an object with null strings for name, employee number, and hire date.
public Employee()
{
name = "";
employeeNumber = "";
hireDate = "";
}
//The setName method sets the employee's name.
public void setName(String n)
{
name = n;
}
//The setEmployeeNumber method sets the employee's number.
public void setEmployeeNumber(String e)
{
if (isValidEmpNum(e))
employeeNumber = e;
else
employeeNumber = "";
}
//The setHireDate method sets the employee's hire date.
public void setHireDate(String h)
{
hireDate = h;
}
//The getName method returns the employee's name.
public String getName()
{
return name;
}
//The getEmployeeNumber method returns the employee's number.
public String getEmployeeNumber()
{
return employeeNumber;
}
//The getHireDate method returns the employee's hire date.
public String getHireDate()
{
return hireDate;
}
//isValidEmpNum is a private method that determines whether a string is a valid employee number.
private boolean isValidEmpNum(String e)
{
boolean status = true;
if (e.length() != 5)
status = false;
else
{
if ((!Character.isDigit(e.charAt(0))) ||
(!Character.isDigit(e.charAt(1))) ||
(!Character.isDigit(e.charAt(2))) ||
(e.charAt(3) != '-') ||
(!Character.isLetter(e.charAt(4))))
status = false;
}
return status;
}
//toString method @return A reference to a String representation of the object.
public String toString()
{
String str = "Name: " + name + " Employee Number: ";
if (employeeNumber == "")
str += "INVALID EMPLOYEE NUMBER";
else
str += employeeNumber;
str += (" Hire Date: " + hireDate);
return str;
}
}
import java.text.DecimalFormat;
public class ShiftSupervisor extends Employee
// TODO Auto-generated method stub
{
private double salary;
private double bonus;
public ShiftSupervisor(String n,String num,String date,double sal, double b){
super();
salary= sal;
bonus= b ;
}
public ShiftSupervisor()
{
super();
salary= 0.0;
bonus= 0.0 ;
}
public void setSalary(double s)
{
salary = s;
}
public void setBonus(double b)
{
bonus=b;
}
public double getSalary()
{
return salary;
}
public double getBonus()
{
return bonus;
}
public String toString()
{
DecimalFormat dollar= new DecimalFormat("#,##0.00");
String str=super.toString();
str+=(" Annual Salary: $" + dollar.format(salary));
str+=(" Production Bonus: $" + dollar.format(bonus));
return str;
}
}

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