Answer to Question #201099 in Java | JSP | JSF for Hamza

Question #201099

The Custom Consulting Company (CCC) places temporary computer professionals in companies that request such employees. CCC’s business can be explained as follows:


CCC keeps a list of professionals willing to work or currently working on a temporary assignment. A professional may have up to three qualifications, including programmer, senior programmer, analyst, tester, designer, and so on. A company always requests a professional with a single specific qualification. CCC keeps a list of all its clients (that is, a list of other companies) and their current needs. If CCC can find a match, a professional with the required qualification is assigned to a specific opening at one of CCC’s clients.


Identify at least five classes and, for each class, list possible data members and methods.


1
Expert's answer
2021-05-31T05:38:38-0400
import java.util.ArrayList;


class Person {
		private String fullName;
		private String phoneNumber;
		private String emailAddress;


		/**
		 * Constructor with arguments
		 * 
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 */
		public Person(String fullName, String phoneNumber, String emailAddress) {
			this.fullName = fullName;
			this.phoneNumber = phoneNumber;
			this.emailAddress = emailAddress;
		}


		/**
		 * @return the fullName
		 */
		public String getFullName() {
			return fullName;
		}


		/**
		 * @param fullName the fullName to set
		 */
		public void setFullName(String fullName) {
			this.fullName = fullName;
		}


		/**
		 * @return the phoneNumber
		 */
		public String getPhoneNumber() {
			return phoneNumber;
		}


		/**
		 * @param phoneNumber the phoneNumber to set
		 */
		public void setPhoneNumber(String phoneNumber) {
			this.phoneNumber = phoneNumber;
		}


		/**
		 * @return the emailAddress
		 */
		public String getEmailAddress() {
			return emailAddress;
		}


		/**
		 * @param emailAddress the emailAddress to set
		 */
		public void setEmailAddress(String emailAddress) {
			this.emailAddress = emailAddress;
		}


	}


	class Client extends Person {
		private String qualificationTarget;
		/**
		 *  Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param qualificationTarget
		 */
		public Client(String fullName, String phoneNumber, String emailAddress, String qualificationTarget) {
			super(fullName, phoneNumber, emailAddress);
			this.qualificationTarget = qualificationTarget;
		}


		/**
		 * @return the qualificationTarget
		 */
		public String getQualificationTarget() {
			return qualificationTarget;
		}


		/**
		 * @param qualificationTarget the qualificationTarget to set
		 */
		public void setQualificationTarget(String qualificationTarget) {
			this.qualificationTarget = qualificationTarget;
		}
	}


	abstract class Employee extends Person {
		private String qualifications[];
		private int age;
		private double salary;
		/**
		 *  Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 */
		public Employee(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String qualifications[]) {
			super(fullName, phoneNumber, emailAddress);
			this.age = age;
			this.salary = salary;
			this.qualifications = qualifications;
		}


		/**
		 * @return the age
		 */
		public int getAge() {
			return age;
		}


		/**
		 * @param age the age to set
		 */
		public void setAge(int age) {
			this.age = age;
		}


		/**
		 * @return the salary
		 */
		public double getSalary() {
			return salary;
		}


		/**
		 * @param salary the salary to set
		 */
		public void setSalary(double salary) {
			this.salary = salary;
		}


		/**
		 * @return the qualifications
		 */
		public String[] getQualifications() {
			return qualifications;
		}


		/**
		 * @param qualifications the qualifications to set
		 */
		public void setQualifications(String qualifications[]) {
			this.qualifications = qualifications;
		}
	}


	class Programmer extends Employee {
		private int experienceLevel;
		/**
		 *  Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 * @param experienceLevel
		 */
		public Programmer(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String[] qualifications, int experienceLevel) {
			super(fullName, phoneNumber, emailAddress, age, salary, qualifications);
			this.experienceLevel = experienceLevel;
		}


		/**
		 * @return the experienceLevel
		 */
		public int getExperienceLevel() {
			return experienceLevel;
		}


		/**
		 * @param experienceLevel the experienceLevel to set
		 */
		public void setExperienceLevel(int experienceLevel) {
			this.experienceLevel = experienceLevel;
		}


	}


	class SeniorProgrammer extends Programmer {
		private double salaryBonus;
		/**
		 *  Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 * @param experienceLevel
		 * @param salaryBonus
		 */
		public SeniorProgrammer(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String[] qualifications, int experienceLevel, double salaryBonus) {
			super(fullName, phoneNumber, emailAddress, age, salary, qualifications, experienceLevel);
			this.salaryBonus = salaryBonus;
		}


		/**
		 * @return the salaryBonus
		 */
		public double getSalaryBonus() {
			return salaryBonus;
		}


		/**
		 * @param salaryBonus the salaryBonus to set
		 */
		public void setSalaryBonus(double salaryBonus) {
			this.salaryBonus = salaryBonus;
		}


	}


	class Analyst extends Employee {
		private boolean workWithBigData;
		/**
		 * Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 * @param workWithBigData
		 */
		public Analyst(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String[] qualifications, boolean workWithBigData) {
			super(fullName, phoneNumber, emailAddress, age, salary, qualifications);
			this.workWithBigData = workWithBigData;
		}


		/**
		 * @return the workWithBigData
		 */
		public boolean isWorkWithBigData() {
			return workWithBigData;
		}


		/**
		 * @param workWithBigData the workWithBigData to set
		 */
		public void setWorkWithBigData(boolean workWithBigData) {
			this.workWithBigData = workWithBigData;
		}
	}


	class Tester extends Employee {
		private boolean hasExcellentCommunicationSkills;
		/**
		 * Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 */
		public Tester(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String[] qualifications,boolean hasExcellentCommunicationSkills) {
			super(fullName, phoneNumber, emailAddress, age, salary, qualifications);
			this.hasExcellentCommunicationSkills=hasExcellentCommunicationSkills;
		}
		/**
		 * @return the hasExcellentCommunicationSkills
		 */
		public boolean isHasExcellentCommunicationSkills() {
			return hasExcellentCommunicationSkills;
		}
		/**
		 * @param hasExcellentCommunicationSkills the hasExcellentCommunicationSkills to set
		 */
		public void setHasExcellentCommunicationSkills(boolean hasExcellentCommunicationSkills) {
			this.hasExcellentCommunicationSkills = hasExcellentCommunicationSkills;
		}
		
	}


	class Designer extends Employee {
		private boolean hasITskills;
		/**
		 *  Constructor with arguments
		 * @param fullName
		 * @param phoneNumber
		 * @param emailAddress
		 * @param age
		 * @param salary
		 * @param qualifications
		 */
		public Designer(String fullName, String phoneNumber, String emailAddress, int age, double salary,
				String[] qualifications,boolean hasITskills) {
			super(fullName, phoneNumber, emailAddress, age, salary, qualifications);
			this.hasITskills=hasITskills;
		}
		/**
		 * @return the hasITskills
		 */
		public boolean isHasITskills() {
			return hasITskills;
		}
		/**
		 * @param hasITskills the hasITskills to set
		 */
		public void setHasITskills(boolean hasITskills) {
			this.hasITskills = hasITskills;
		}
	}
	
public class Q201099 {


	/**
	 * Main method
	 * @param args
	 */
	public static void main(String args[]) {
		ArrayList<Employee> employees=new ArrayList<Employee>();  
		String qualifications[]= {"C++","C Sharp","Vb.net"};
		Programmer programmer=new Programmer("Dennis Niemeyer", "055963256", "Niemeyer@gmail.com", 35,2000, qualifications, 8);
		String qualificationsSeniorProgrammer[]= {"ASP.net","C Sharp","Vb.net"};
		SeniorProgrammer seniorProgrammer=new SeniorProgrammer("Emil Lingenfelter", "08856235", "Lingenfelter@gmail.com", 45,5000, qualificationsSeniorProgrammer, 10,560.5);
		String qualificationsAnalyst[]= {"Analyse Big Data","Collect Data","Import Export Data"};
		Analyst analyst=new Analyst("Harold Lewallen", "055632635", "Lewallen@gmail.com", 25, 2300, qualificationsAnalyst, true);
		String qualificationsTester[]= {"Test ASP.net sites","Test python programs","Test Java programs"};
		Tester tester =new Tester("Levin Langan", "088562356",  "Langan@gmail.com", 32, 1500, qualificationsTester, false);
		String qualificationsDesigner[]= {"PhotoShop","Games Designer ","Paint"};
		Designer designer =new Designer("Reuben Beesley", "06616395458", "Beesley@gmail.com", 34, 3500, qualificationsDesigner, true);
		
		employees.add(programmer);
		employees.add(seniorProgrammer);
		employees.add(analyst);
		employees.add(tester);
		employees.add(designer);
		
		
		
		Client client1=new Client("Mary Clark","05568956", "Clark@gmail.com", "C++");
		Client client2=new Client("Gloria Fenderson","03325698", "Fenderson@gmail.com", "PhotoShop");
		Client client3=new Client("Ella Ostrowski","0445865955", "Ostrowski@gmail.com", "Test ASP.net sites");
		
		
		for(int i=0;i<employees.size();i++) {
			for(int q=0;q<3;q++) {
				if(employees.get(i).getQualifications()[q].compareToIgnoreCase(client1.getQualificationTarget())==0) {
					System.out.println("The client "+client1.getFullName() +" has found the employee: ");
					displayEmployee(employees.get(i));
					break;
				}
			}
			for(int q=0;q<3;q++) {
				if(employees.get(i).getQualifications()[q].compareToIgnoreCase(client2.getQualificationTarget())==0) {
					System.out.println("\nThe client "+client2.getFullName() +" has found the employee: ");
					displayEmployee(employees.get(i));
					break;
				}
			}
			for(int q=0;q<3;q++) {
				if(employees.get(i).getQualifications()[q].compareToIgnoreCase(client3.getQualificationTarget())==0) {
					System.out.println("\nThe client "+client3.getFullName() +" has found the employee: ");
					displayEmployee(employees.get(i));
					break;
				}
			}
		}
		
		
	}
	/**
	 * Displays employee
	 * @param emp
	 */
	static void displayEmployee(Employee emp) {
		System.out.println("Employee full name: "+emp.getFullName());
		System.out.println("Employee email address: "+emp.getEmailAddress());
		System.out.println("Employee salary: "+emp.getSalary());
		System.out.println("Employee qualifications: "+emp.getQualifications()[0]+", "+emp.getQualifications()[1]+", "+emp.getQualifications()[2]);	}
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS