473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Don't know where the error

import javax.swing.JOptionPane;
public class AddStaff{

public static void main(String args[]){
String StaffName;
String StaffCurrPosition;
String Salary;
String SalaryInDouble;
int x;

SalaryCalculation[] StaffSalary = new SalaryCalculation[2];

for (x = 0; x < 2; x++){
StaffName = JOptionPane.showInputDialog("Please enter Staff Name");
StaffCurrPosition = JOptionPane.showInputDialog("Please enter STAFF
POSITION");
Salary = JOptionPane.showInputDialog("Please enter STAFF SALARY");
StaffSalary[x] = new SalaryCalculation(StaffName,StaffCurrPosition,Sala ry);
}
StaffName = JOptionPane.showInputDialog("Please enter Manager Name");
StaffCurrPosition = JOptionPane.showInputDialog("Please enter Staff
POSITIOn");
Salary = JOptionPane.showInputDialog("Please enter Staff Salary");
SalaryCalculation Manager = new
SalaryCalculation(StaffName,StaffCurrPosition,Sala ry);

//View Staff Information;

StaffName = StaffSalary[0].ReturnStaffName(); //<< the error


}
}
public class SalaryCalculation{
String StaffName;
String CurrPosition;
String Salary;
double SalaryInDouble;
public SalaryCalculation(String StaffName,String CurrPosition,String
Salary){
StaffName = StaffName;
CurrPosition = CurrPosition;
Salary = Salary;
ToUpperCase();
SalaryConverting();
SalaryCalculation();
}

private void ToUpperCase(){
StaffName = StaffName.toUpperCase();
}

private void SalaryConverting(){
SalaryInDouble = Double.parseDouble(Salary);
}
private void SalaryCalculation(){
SalaryInDouble = SalaryInDouble * 5 / 100;
}

public double ReturnSalary(){
return SalaryInDouble;

}
public String ReturnStaffName(){
return StaffName;
}
public String ReturnPosition(){
return CurrPosition;
}

}
i try to fix the error for damn long hours.. still can't fix it..

--
"If we don't stand together than this is the end"
The Business

Jul 17 '05 #1
2 1447

Here is the error:
StaffName = StaffName;
CurrPosition = CurrPosition;
Salary = Salary;


Change the above code to:

this.StaffName = StaffName;
this.CurrPosition = CurrPosition;
this.Salary = Salary;

Cheerz L.
Jul 17 '05 #2
Nevermind.. i found the mistake..
--
"If we don't stand together than this is the end"
The Business

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
I have broken PythonWin and I don't know how or why. It worked great until recently. I have installed / removed several apps since it worked last. I could have a virus unknown to my antivirus...
3
by: Jacques Koorts | last post by:
Hi I really don't know anymore how to solve this problem. I bought .NET thinking i can debug my way out of it but still no cigar. This very simple piece of code does not work: Now here some...
2
by: Brandon | last post by:
I don't know if this is the right newsgroup for this question . . . if not, please let me know. I'm a newbie to asp.net (C#) and I'm trying to create a very simple page dependent on a master...
4
by: Rob Richardson | last post by:
Greetings! I am working on an application that targets a Pocket PC running Windows CE and SQL Server CE. Almost all functions in the application use a Try block with a Catch block that looks...
13
by: rdemyan via AccessMonster.com | last post by:
My front-end code manually links to the backend file. I was wondering what stops Access from linking to the system tables in the backend file. Is it just by virtue that they are hidden? This...
8
by: Simon Willison | last post by:
Hi all, I have an API design question. I'm writing a function that can either succeed or fail. Most of the time the code calling the function won't care about the reason for the failure, but...
9
by: Tonio Tanzi | last post by:
I have an asp page with this tag <body onLoad="show_msg('<%=error_msg%>');"> where "show_msg" is a javascript function that shows the message contained in the asp variable "error_msg" only if...
21
by: jehugaleahsa | last post by:
Hello: I had an hour-long discussion with my boss today. Last night, right before I dozed off, I realized some of his code resulted in duplicate processing. I tried to explain it to him and he...
11
by: Jan | last post by:
Hi: Here's a problem I've had for a long time. The client is really running out of patience, and I have no answers. Access2003, front- and back-end. Single form with 4 subforms (each...
0
by: Stef Mientki | last post by:
Terry Reedy wrote: sorry, don't know how this happened, as I always copy/paste ? AFAIK locals() == sys._getframe(0).f_locals AFAIK, again one level up weird, I use it in 2.5 and if I remember...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.