Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I Need help to run these programs in NETBEANS OR ECLIPSE

I Need help to run these programs in NETBEANS OR ECLIPSE. PLSEASE LET ME KNOW RIGHT AWAY IF U CAN HELP.

/*

SETH YEBOAH

CMIS 242

PROJECT 1

8/30/2015

*/

package Project1Main;

import java.io.File;

import java.io.FileNotFoundException;

import java.io.BufferedReader;

import java.io.FileReader;

import java.io.IOException;

/**

*

* @author SETH

*/

public class Project1 {

/**

* @param args the command line arguments

*/

public static void main(String[] args) throws IOException {

String line;

int Counter2014 = 0, Counter2015 = 0;

Employee [] a2014data =new Employee[20];

Employee [] a2015data =new Employee[20];

String [] temp;

try{

//Read from file the data

BufferedReader reader =new BufferedReader(new FileReader(“Project1.txt”));

line=reader.readLine();

//Count number of 2014 vs 2015 Employees and put them into proper array

//A temporary array is used to copy information and calculate the proper place

while(line!=null){

//info in the file is seperated by spaces

temp=line.split(” “);

/*The folling flow determines the type of employee, which is the second

value stored in each line, then adds to a counter based on

whether the year is 2014 or 2015

*/

if(temp[1].equals(“Employee”)){

if(temp[0].equals(“2014”)){

a2014data[Counter2014]=new Employee(temp[2],Integer.parseInt(temp[3]));

Counter2014++;

}

else{

a2015data[Counter2015]=new Employee(temp[2],Integer.parseInt(temp[3]));

Counter2015++;

}

}

else if(temp[1].equals(“Salesman”)){

if(temp[0].equals(“2014”)){

a2014data[Counter2014]=new Salesman(temp[2],Integer.parseInt(temp[3]),Integer.parseInt(temp[4]));

Counter2014++;

}

else{

a2015data[Counter2015]=new Salesman(temp[2],Integer.parseInt(temp[3]),Integer.parseInt(temp[4]));

Counter2015++;

}

}

else if(temp[1].equals(“Executive”)){

if(temp[0].equals(“2014”)){

a2014data[Counter2014]=new Executive(temp[2],Integer.parseInt(temp[3]),Integer.parseInt(temp[4]));

Counter2014++;

}

else{

a2015data[Counter2015]=new Executive(temp[2],Integer.parseInt(temp[3]),Integer.parseInt(temp[4]));

Counter2015++;

}

}

line=reader.readLine();

}

//close file

reader.close();

double average2014,average2015;

double sum2014=0,sum2015=0;

//Print EMployee data 2014

System.out.println(“2014 Employees:”);

for (int x = 0; x < Counter2014; x++) {

System.out.println(“Employee ” + (x + 1) + “:”);

System.out.println(“Name: ” + a2014data[x].getEmployeeName());

System.out.println(“Monthly salary: $” + a2014data[x].getMonthlySalary());

System.out.println(“Annual Salary: $” + a2014data[x].annualSalary());

//Add the annual salary to compute the sum

sum2014 += a2014data[x].annualSalary();

System.out.println();

}

//Print 2015 Employee Data

System.out.println(“2015 Employees:”);

for (int x = 0; x < Counter2015; x++) {

System.out.println(“Employee ” + (x + 1) + “:”);

System.out.println(“Name: ” + a2015data[x].getEmployeeName());

System.out.println(“Monthly salary: $” + a2015data[x].getMonthlySalary());

System.out.println(“Annual Salary: $” + a2015data[x].annualSalary());

//Add the annual salary to compute the sum

sum2015 += a2015data[x].annualSalary();

System.out.println();

}

//Avg is calculated by sum divided by total salaries

average2014 = sum2014/ Counter2014;

average2015 = sum2015/ Counter2015;

//Print the averages, as required

System.out.printf(“Average annual salary of 2014: $%.2f \n”, average2014);

System.out.printf(“Average annual salary of 2015: $%.2f\n\n”, average2015);

}

//Exception handler

catch (FileNotFoundException EFS){

System.out.println(EFS);

}

}

}

QUESTION 2

/* Employee[] employees14;
Employee[] employees15;

employees14 = new Employee[10];
employees15 = new Employee[10];

String line;
String [] temp;

try{
BufferedReader br = new BufferedReader(new FileReader(“Project1.txt”));
}
/*
employees14[0] = new Employee(2014, “Smith, John”, 2000);
employees15[0] = new Salesman(2015, “Jones, Bill”, 3000, 100000);
employees14[1] = new Executive(2014, “Bush, George”, 5000, 55);
employees15[1] = new Executive(2014, “Bush, George”, 6000, 55);

double averageSalary14 = 0;
double averageSalary15 = 0;

System.out.println(“****** Employee Data ******”);
for (int i = 0; i < employees14.length; i++) {
System.out.println(“Employee ” + (i + 1) + “:”);
System.out.println(“Name: ” + employees14[i].getEmployeeName());
System.out.println(“Monthly salary: $” + employees14[i].getMonthlySalary());
System.out.println(“Annual Salary: $” + employees14[i].annualSalary());
System.out.println();
averageSalary14 += employees14[i].annualSalary();
}
averageSalary14 /= 3.0;
System.out.printf(“Average salary for all 2014 employees: $”);
System.out.printf(“%.2f\n”, averageSalary14);

for (int i = 0; i < employees15.length; i++) {
System.out.println(“Employee ” + (i + 1) + “:”);
System.out.println(“Name: ” + employees15[i].getEmployeeName());
System.out.println(“Monthly salary: $” + employees15[i].getMonthlySalary());
System.out.println(“Annual Salary: $” + employees15[i].annualSalary());
System.out.println();
averageSalary15 += employees15[i].annualSalary();
}
averageSalary15 /= 3.0;
System.out.printf(“Average salary for all 2015 employees: $”);
System.out.printf(“%.2f\n”, averageSalary15);

}
}
*/

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"