Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 22nd, 2005, 11:03 AM   #11
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
Thank guys, I managed fixing the first problem, am facing a second problem now, this This is what i get after compiling Database.java file

Note: Database.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for deta

So this is what i did

moderator@amer:~/Desktop/amer$ javac -Xlint:unchecked Database.java
Database.java:14: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
                EmployeesData.addElement(emp);
                                        ^
1 warning
moderator@amer:~/Desktop/amer$

This is my Database.java file code
import java.util.*;
import java.io.*;
import java.lang.*;
import java.util.Vector;

public class Database 
{
	Vector EmployeesData = new Vector();
		
	public void addEmployeeData(Employee emp)
	{
(This is line 14)==>>		EmployeesData.addElement(emp);
	}
	
	public void printEmployeesData (PrintStream ps)
	{

		Employee tempEmp;
		int k=0;
		
	ps.println(new String("Amer Al-Tagi" ));
    	ps.println(new String("Homework 3: Payroll Calculations:"));
    	ps.println(new String(""));
    	ps.println(new String("Full Time Employees"));
    	ps.println(new String("================================================================="));
	ps.println(new String("ID" + "		" + "FName" + "	" +"LName"+"	"+"Dept"+"	"+"Salary"));
	ps.println(new String("================================================================="));
    	
		for (k=0; k<EmployeesData.size(); k++)
		{			
			if (EmployeesData.elementAt(k) instanceof FullTimeEmployee)
			{
				tempEmp = (Employee) EmployeesData.elementAt(k);
				tempEmp.printEmployee(ps);
			}
			
		}
		
		ps.println(new String(""));
		ps.println(new String("Part Time Employees"));
    		ps.println(new String("================================================================="));
		ps.println(new String("ID" + "		" + "FName" + "	" +"LName"+"	"+"Dept"+"	"+"Salary"));
		ps.println(new String("================================================================="));
    	
		for (k=0; k<EmployeesData.size(); k++)
		{			
			if (EmployeesData.elementAt(k) instanceof PartTimeEmployee)
			{
				tempEmp = (Employee) EmployeesData.elementAt(k);
				tempEmp.printEmployee(ps);
			}
			
		}
	}
	

}
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Dec 22nd, 2005, 12:03 PM   #12
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 843
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Try replacing line 12 (which you have marked line 14) with this:

Vector<Employee> EmployeesData = new Vector<Employee>();
Also, you still have too many import statements. java.lang.* is imported automatically in any java project, and java.util.* includes java.util.Vector. So the only import statements you need are:

import java.util.*;
import java.io.*;
titaniumdecoy is online now   Reply With Quote
Old Dec 22nd, 2005, 12:21 PM   #13
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
Thanks a lot titaniumdecoy, it works now, i appreciate your help.
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:43 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC