Question

In: Computer Science

this question has been answered incorrectly several times can someone answer it correctly and show me...

this question has been answered incorrectly several times can someone answer it correctly and show me some examples of a run

Design and implement a class named Person and its two subclasses named Student and Employee.

Make Faculty and Staff subclasses of Employee.

A person has a name,address, phone number, and email address.

A student has a class status (year 1,year 2,year 3,or year 4).

An employee has an office, salary, and date hired.

Use the Date class from JavaAPI 8 to create an object for date hired.

A faculty member has office hours and a rank.

A staff member has a title.

Override the toString method in each class to display the class name and the person’s name.Design and implement all 5classes.

Write a test program that creates a Person,Student,Employee,Faculty, and Staff, and iinvokes their toString()methods

Solutions

Expert Solution

import java.util.*;
import java.lang.*;

// Person class
class Person{
   String name;
   String address;
   int[] phone = new int[10];
   String email;
   Person(String name,String address,String email){ // Person class constructor
       this.name = name;
       this.address = address;
       this.email = email;
   }
   Person(String name,String address){
       this.name = name;
       this.address = address;
   }
   public String toString(){
       return (name + " " + address + " " + email + " class : Person");
   }
}

// Student class
class Student extends Person{
   String year;
   Student(String name,String address,String email){ // Student class constructor
       super(name,address);
       this.email = email;
   }
   public String toString(){
       return (name + " " + address + " " + email + " class : Student");
   }
}

// Employee class
class Employee extends Person{
   String office;
   String salary;
   String date;
   Employee(String name,String address,String email){ // Employee class constructor
       super(name,address);
       this.email = email;
   }
   Employee(String name,String address){
       super(name,address);
   }
   public String toString(){
       return (name + " " + address + " " + email + " class : Employee");
   }
}

// Faculty class
class Faculty extends Employee{
   String hour;
   int rank;
   Faculty(String name,String address,String email){ // Faculty class constructor
       super(name,address);
       this.email = email;
   }
   public String toString(){
       return (name + " " + address + " " + email + " class : Faculty");
   }
}

// Staff class
class Staff extends Employee{
   String title;
   Staff(String name,String address,String email){ // Staff class constructor
       super(name,address);
       this.email = email;
   }
   public String toString(){
       return (name + " " + address + " " + email + " class : Staff");
   }
}
public class Solution {
   public static void main(String[] args){
       Date d1 = new Date();
   System.out.println("Current date is " + d1);
       Person p = new Person("Adam","132KV Station","adam"); // Make a person class object
       Student s = new Student("John","132KV Station","john"); // Make a student class object
       Employee e = new Employee("Rocky","132KV Station","rocky"); // Make a student class object
       Faculty f = new Faculty("Fira","132KV Station","fira"); // Make a faculty class object
       Staff o = new Staff("Ram","132KV Station","ram"); // Make a staff class object
       // Call toString method
       System.out.println(p);
       System.out.println(s);
       System.out.println(e);
       System.out.println(f);
       System.out.println(o);
   }
}

Output :


Related Solutions

***PLEASE ANSWER QUESTION AGAIN (SOMEONE ELSE)- FIRST ONE WAS ANSWERED INCORRECTLY The cash records of Jasmin...
***PLEASE ANSWER QUESTION AGAIN (SOMEONE ELSE)- FIRST ONE WAS ANSWERED INCORRECTLY The cash records of Jasmin Company show the following four situations: 1) The June 30 bank reconciliation indicated that deposits in transit total $2,110. During July the general ledger account Cash shows deposits of $23,620, but the bank statement indicates that only $23,400 in deposits were received during the month. 2) The June 30 bank reconciliation also reported outstanding checks of $1,250. During the month of July, Jasmin Company...
Can someone check to see if I answered them correctly? The answers are highlighted in Bold...
Can someone check to see if I answered them correctly? The answers are highlighted in Bold font. I also need help with Question 6 1) What criteria must sales transactions meet in order for the seller to recognize revenues before collecting cash? a. The revenues must be earned (the firm must have achieved substantial performance). b. The amount to be received must qualify as an asset (there must be a future economic benefit and the amount must be measured with...
Can someone show me how this answer is 8,080 ? I keep coming up with the...
Can someone show me how this answer is 8,080 ? I keep coming up with the wrong number. Stellar Company has the following sales, variable cost, and fixed cost. If sales increase by $10,000 then their profit increases/decreases by how much? Sales $50,000 Variable Costs $9,600 Fixed Costs $29,000 Answer is 8,080 Calculate the total cost of FC and VC for $50,000. 2) Calculate the increase in VC based on the % increase in Sales. VC/50000 * new sales 3)...
Can someone please show me how to do the work on this please. Question The transactions...
Can someone please show me how to do the work on this please. Question The transactions of the Fury Delivery Service are recorded in the general journal below. Instructions: 1. Post the journal entries to the attached general ledger “T” accounts. 2. Prepare a trial balance on the form provided after the “T” accounts. General Journal Date Account Titles and Explanation Debit Credit 2017 Sept. 1 Cash Common Stock (Stockholders invested cash in business) 25,000 25,000 4 Equipment Cash Notes...
This problem has already been half answered, but can someone finish it and check the answers....
This problem has already been half answered, but can someone finish it and check the answers. I'll include the link. Finished ASAP please! https://www.chegg.com/homework-help/questions-and-answers/use-weighted-average-costing-wanda-company-produces-finished-product-two-processing-depart-q29753062 USE WEIGHTED AVERAGE COSTING: Wanda Company produces its finished product in two processing departments--Mixing and Finishing. The following information is available for the month of March: Mixing Department: The beginning work-in-process inventory was $17,130 ($14,880 direct materials and $2,250 conversion costs) and consisted of 1,200 units. During March, an additional 10,600 units were started into production....
without using excel can someone show me the steps to approach the following question Question 2...
without using excel can someone show me the steps to approach the following question Question 2 Rump Industries Ltd expects its new product will give it a significant first mover advantage in the market and that is expected to provide growth in earnings per share of 400% within the coming year, and 75% growth in each of the subsequent 3 years. After that time, it is expected competitors will have developed and brought to market similar products with the result...
Posted this question yesterday but whoever answered it did not answer correctly. I am stuck on...
Posted this question yesterday but whoever answered it did not answer correctly. I am stuck on number 2; missing something but not sure what. Any help is appreciated. Lou Barlow, a divisional manager for Sage Company, has an opportunity to manufacture and sell one of two new products for a five-year period. His annual pay raises are determined by his division’s return on investment (ROI), which has exceeded 22% each of the last three years. He has computed the cost...
Hi, I can't figure out this question in excel, can someone please show me the excel...
Hi, I can't figure out this question in excel, can someone please show me the excel formulas to input in order to solve for part A and B please!!!! The following table contains closing monthly stock prices for Oracle Corporation (ORCL), Microsoft Corporation (MSFT), and NVidia (NVDA) for the first half of 2017. Ticker 6/30/2017 5/31/2017 4/30/2017 3/31/2017 2/28/2017 1/31/2017 ORCL 50.14 45.39 44.96 44.61 42.59 40.11 MSFT 68.93 69.84 68.46 65.86 63.98 64.65 NVDA 144.56 144.35 104.3 108.93 101.48...
Can someone show me how to do this on excel? Question involves cell phone users. Mean...
Can someone show me how to do this on excel? Question involves cell phone users. Mean monthly data usage = 5.8 GB/month StDev monthly data usage = 2.5 GB/month "Heavy users" are those that use >= 9 GB/month a.) What is the probability a "heavy user" uses more than 10 GB/month? b.) Two users are selected at random. What is the probability at least one of them is a heavy user? c.) Five users are selected at random. What is...
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All...
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All S2O32- is consumed at the end of the reaction. Therefore, the moles of S2O32- consumed can be calculated using the equation below. (moles S2O32-)consumed = Mstock x (Vstock) My instructor states "The stock sodium thiosulfate (S2O3) is 0.01M 0.01M x 0.010 L = 0.0001moles S2O3" So I did the rest of this accordingly (below), and it differs a lot from what's on this website....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT