They have contracted you to prepare a report based on the information in the database (CSUData.txt) and project the cost to the University. The database (CSUData.txt) contains the following information:
•Name - String
•Years of Service - Integer
•Academic Status ( 1 – Tenure/Tenure-Track, 2 – Non-Tenure Track)
•Current Yearly Salary - Double
Secondly, they need you to prepare a report containing the following information:
2.Determine and display the name and percentage raise for each faculty member.
I know i have to determine first how much percentage raise each faculty member are getting by looking at how many year of services they had and their academic status. I was doing something like this:
public void getPercent(String[] name, double[] yearsc,double [] statusr, double[] yearlySalaryst)
{
for (int index = 0; index < sc.length; index++)
{ System.out.println(" Faculty members and their percentage of raise ");
if (year[index] <= 5 && status[index] == 1)
status[index] = 2;
if (year[index] <= 5 && status[index] == 2)
[index] = 1;
if (year[index] <= 14 && status[index] ==1)
status[index] = 4;
if (year[index] <= 14 && status[index] ==2)
status[index] = 2;
if (year[index] <= 24 && status[index] == 1)
status[index] = 6;
if (year[index] <= 24 && status[index]== 2)
status[index] = 3;
if (year[index] >= 25 && status[index] == 1)
status[index] = 8;
if (year[index] >= 25 && status[index] ==2)
status[index] = 4;
System.out.print(name[index] + ", " + r[index]+"%");
}
}
Assignment5.Java File
public class Assignment5
{
private String name;
private double year;
private double status;
private double yearlySalary;
private int[] percentages=new int [19];
public Assignment5 (String n, double y, double s, double ys)
{
name = n;
year = y;
status = s;
yearlySalary = ys;
}
public String getName()
{
return name;
}
public double getYear()
{
return year;
}
public double getStatus()
{
return status;
}
public double getYearlySalary()
{
return yearlySalary;
}
public void setPercentage (String name)
{
int percentage;
double year= getYear();
if (year > 25)
percentage=8;
else if (year > 15)
percentage=6;
else if (year > 6)
percentage=4;
else
percentage=2;
//percentages[name]=percentage;
}
//public int getPercentage (int id)
//{
//return percentages[name];
//}
public String toString()
{
String str = "";
str += name + "\t ";
str += year + "\t ";
str += status + "\t\t";
str += yearlySalary + "\t\t";
return str;
}
}
Assignment5Demo.Java
import java.util.Scanner;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.*;
public class Assignment5Demo
{
public static void main(String[] args) throws IOException
{
String data;
ArrayList<Assignment5> courses = new ArrayList<Assignment5>();
//read info from a file
File inputFile = new File("CSUData.txt");
Scanner input = new Scanner(inputFile);
while(input.hasNext())
{
//read first line
data = input.nextLine();
StringTokenizer token = new StringTokenizer(data,"/");
//get name
String name = token.nextToken();
//get the years of service
double year = Double.parseDouble(token.nextToken());
// get the academic status
double status = Double.parseDouble(token.nextToken());
// get the current yearly salary
double yearlySalary = Double.parseDouble(token.nextToken());
Assignment5 Temp = new Assignment5 (name, year, status, yearlySalary);
courses.add(Temp);
}
input.close();
//display the contents of the file
System.out.println("*Contents of the file");
System.out.println();
System.out.println(" Name Years of Academic Current");
System.out.println(" Services Status Yearly Salary");
for( int i = 0; i < courses.size(); i++)
{
//Display the course's
System.out.println(courses.get(i));
}
}
}
The CSUDate.txt file that has the information
Caldwell,E./25/1/117000 Matlock B./5/2/32000 Fletcher J./17/2/64000 Matlock, M./35/2/45000 Bajwa, J./22/1/10000 Flinstone, F./10/2/25000 Rubble, B./2/1/50000 Keaton, W./7/1/55000 Graham, M./2/1/50000 Barkly, J./0/2/25000 Madison, K./12/1/40000 Posten, F./10/1/65000 Browne, J./15/1/40000 Black, B./2/1/50000 Patton, C./2/1/50000 Lofton, C./2/1/50000 Batton, P./6/1/37000 Duck, D./2/2/15000 Washington, D./5/1/80000
Attached File(s)
-
CSUData.txt (434bytes)
Number of downloads: 7

New Topic/Question
Reply




MultiQuote



|