Question: plz transfer from java to c++ import java.util.*; import java.io.*; /** * * @author osborn */ public class EmployeePay { private ArrayList employees; private Scanner
plz transfer from java to c++
import java.util.*; import java.io.*; /** * * @author osborn */ public class EmployeePay { private ArrayList employees; private Scanner input; public EmployeePay() { employees = new ArrayList(); } private void getData() { File inFile = new File("EmployeeData.txt"); try { input = new Scanner(inFile); } catch (FileNotFoundException ex) { ex.printStackTrace(); System.exit(1); } String type, name; int year, salary, hours; double wage; Employee e = null; while(input.hasNext()) { type = input.next(); name = input.next(); year = input.nextInt(); if (type.equalsIgnoreCase("manager") || type.equalsIgnoreCase("staff")) { salary = input.nextInt(); if (type.equalsIgnoreCase("manager")) { e = new Manager(name, year, salary); } else { e = new Staff(name, year, salary); } } else if (type.equalsIgnoreCase("fulltime") || type.equalsIgnoreCase("parttime")) { hours = input.nextInt(); wage = input.nextDouble(); if (type.equalsIgnoreCase("fulltime")) { e = new FullTime(name, year, hours, wage); } else { e = new PartTime(name, year, hours, wage); } } else { System.out.println("Data error - incorrect employee type"); System.exit(1); } employees.add(e); } } private void displayEmployees() { // Add the code that will do this } } /** * @param args the command line arguments */ public static void main(String[] args) { EmployeePay ep = new EmployeePay(); ep.getData(); ep.displayEmployees(); } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
