Title | Java TFA Solution |
---|---|
Author | Yaswanth Jami |
Course | Japanese basics |
Institution | Lovely Professional University |
Pages | 27 |
File Size | 431 KB |
File Type | |
Total Downloads | 638 |
Total Views | 861 |
Code Red TechnologiesCasualEmployeepublic class CasualEmployee extends Employee{ private int supplementaryHours; private double foodAllowance;public CasualEmployee(String employeeId, String employeeName, int yearsOfExperience, String gender, double salary, int supplementaryHours, double foodAllowanc...
Code Red Technologies CasualEmployee.java
public class CasualEmployee extends Employee{ private int supplementaryHours; private double foodAllowance;
public CasualEmployee(String employeeId, String employeeName, int yearsOfExperience, String gender, double salary, int supplementaryHours, double foodAllowance) { super(employeeId, employeeName, yearsOfExperience, gender, salary); this.supplementaryHours = supplementaryHours; this.foodAllowance = foodAllowance; }
public double calculateIncrementedSalary(int incrementPercentage){ //12 double incrementedSalary=0.0; double additionalSalary; additionalSalary=getSalary()+(supplementaryHours*1000)+foodAllowance;
incrementedSalary=additionalSalary+((additionalSalary*incrementPercentage)/100); return incrementedSalary; } }
Employee.java
public class Employee { protected String EmployeeId; protected String EmployeeName; protected int yearsOfExperience; protected String gender; protected double salary;
public Employee(String employeeId, String employeeName, int yearsOfExperience, String gender, double salary) { EmployeeId = employeeId; EmployeeName = employeeName; this.yearsOfExperience = yearsOfExperience; this.gender = gender; this.salary = salary; }
public String getEmployeeId() { return EmployeeId; }
public void setEmployeeId(String employeeId) { EmployeeId = employeeId; }
public String getEmployeeName() { return EmployeeName; }
public void setEmployeeName(String employeeName) { EmployeeName = employeeName; }
public int getYearsOfExperience() { return yearsOfExperience; }
public void setYearsOfExperience(int yearsOfExperience) { this.yearsOfExperience = yearsOfExperience; }
public String getGender() { return gender; }
public void setGender(String gender) { this.gender = gender; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; } }
PermanentEmployee.java
public class PermanentEmployee extends Employee{ private double medicalAllowance; private double vehicleAllowance;
public PermanentEmployee(String employeeId, String employeeName, int yearsOfExperience, String gender, double salary, double medicalAllowance, double vehicleAllowance) { super(employeeId, employeeName, yearsOfExperience, gender, salary); this.medicalAllowance = medicalAllowance; this.vehicleAllowance = vehicleAllowance; }
public double calculateIncrementedSalary(int incrementPercentage){ //12 double incrementedSalary=0.0; double additionalSalary; additionalSalary=getSalary()+medicalAllowance+vehicleAllowance;
incrementedSalary=additionalSalary+((additionalSalary*incrementPercentage)/100); return incrementedSalary;
} }
TraineeEmployees
public class TraineeEmployees extends Employee{ private int supplementaryTrainingHours; private int scorePoints;
public TraineeEmployees(String employeeId, String employeeName, int yearsOfExperience, String gender, double salary, int supplementaryTrainingHours, int scorePoints) { super(employeeId, employeeName, yearsOfExperience, gender, salary); this.supplementaryTrainingHours = supplementaryTrainingHours; this.scorePoints = scorePoints; }
public double calculateIncrementedSalary(int incrementPercentage){ //5 double incrementedSalary=0.0; double additionalSalary; additionalSalary=getSalary()+(supplementaryTrainingHours*500)+(scorePoints*50);
incrementedSalary=additionalSalary+((additionalSalary*incrementPercentage)/100); return incrementedSalary; } }
UserInterface.java
import java.util.*; public class UserInterface { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter Employee Id"); String empId=sc.nextLine(); System.out.println("Enter Employee Name"); String empName=sc.nextLine(); System.out.println("Enter experience in years"); int yearOfExperience=sc.nextInt(); sc.nextLine(); if(yearOfExperience>=1 && yearOfExperience=6&&yearOfExperience=11&&yearOfExperience0){ for (Entry entry : getFamilyMap().entrySet()) { if (entry.getValue() > Integer.valueOf(values)) { list.add(entry.getKey()); Collections.sort(list); } } } return list; }
}
UserInterFace.java import java.util.Scanner;
public class UserInterFace { public static void main(String[] args) { Scanner sc = new Scanner(System.in); FamilyBO f=new FamilyBO(); System.out.println("Enter the number of families"); int num=sc.nextInt(); sc.nextLine(); for (int i = 0; i < num; i++) { System.out.println("Enter the name"); String name=sc.nextLine();
System.out.println("Enter the family members"); int familyMembers=sc.nextInt(); sc.nextLine(); f.addFamilyDetails(name,familyMembers); } System.out.println("Enter the number of members to search"); int numSearch= sc.nextInt(); if(f.displayFamiliesDetails(numSearch).size()>0){ System.out.println("List of families above " + numSearch + " members");
for(String s:f.displayFamiliesDetails(numSearch)){ System.out.println(s); }
}else{ System.out.println("No Families found"); } } }
Lottery Ticket Contest LotteryTicket.java public class LotteryTicket { private String customerName; private long phoneNumber; private String emailId; private int startingRange; private int endingRange;
public LotteryTicket() {
} public LotteryTicket(String customerName, long phoneNumber, String emailId, int startingRange, int endingRange) { super(); this.customerName = customerName; this.phoneNumber = phoneNumber; this.emailId = emailId; this.startingRange = startingRange; this.endingRange = endingRange; }
public int findNumberOfWinningTickets() { int count=0,temp=0; if(startingRange>=1 && endingRange...