|
-
array and method help
I am totally new to Java...I compiled my menu driven program and I received the following error message:java:58: ';' expected
int add_items(String []number,String []name, double []cost, int []level, int count1)
^
Any ideas on what is wrong and how to fix it would be greatly appreciated.
import javax.swing.JOptionPane;
public class method4
{
public static void main(String[] args)
{
String[] employee_id = new String[100];
String[] employee_name = new String[100];
double[] employee_salary = new double[100];
int[] salary_level = new int[100];
int[] employee_pay = new int[100];
menu();
}
public static void menu()
{// open menu
String svalue;
String output= " how much for you" + "\n" +
"1. Modify Employee Information" + "\n" +
"2. Add/Modify Employee Information" + "\n" +
"3. Report Section" + "\n" +
"4. Exit the System" + "\n" + "\n" +
"Please make your selection> ";
svalue =JOptionPane.showInputDialog(null,
output," ",JOptionPane.QUESTION_MESSAGE);
}//end menu method
public static String modify_inventory()
{//open modify
String svalue;
int i;
String output= " Modify Employee" + "\n" +
"1. Add employee" + "\n" +
"2. Modify employee" + "\n" +
"3. Delete employee" + "\n" +
"4. Exit Modify Employee" + "\n" + "\n" +
"Please make your selection> ";
svalue =JOptionPane.showInputDialog(null,
output," ",JOptionPane.QUESTION_MESSAGE);
// Convert string to intger
int b=Integer.parseInt(svalue);
//menu options
if(b == 1)
{//opening if
//add items adds items to db
int add_items(String []id,String []name, double []salary, int []level, int count1)
{// open add items
int contn;
String scontn, svalue;
//items will be added until told to stop
String output = "Enter 1 to continue and 0 to stop";
scont = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
contn = Integer.parseInt(scont);
while (contn != 0)
{//items added
//items are added to the arrays
count1 = count1 + 1;
output = "Enter the Employee id Number";
number[count1] = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
output = "Enter the employee Name";
name[count1] = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
output = "Enter the salary";
svalue = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
cost[count1] = Double.parseDouble(svalue);
output = "Enter the salary Level";
svalue = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
level[count1] = Integer.parseInt(svalue);
output = "Enter 1 to continue and 0 to stop";
scont = JOptionPane.showInputDialog(null, output, " ",JOptionPane.QUESTION_MESSAGE);
cont = Integer.parseInt(scont);
}//close items added
return count1;
}//close add employee
}// close b=1
else if (b == 2){
String modifyString =JOptionPane.showInputDialog(null,
"enter employee number","employee data",JOptionPane.QUESTION_MESSAGE);
}else if (b == 3){
String deleteString =JOptionPane.showInputDialog(null,
"enter employee number","inventory data",JOptionPane.QUESTION_MESSAGE);
}
return svalue;
}// end modify employee data
public static void modify_employee()
{
String output;
System.out.println(" employee has been added/modified");
}
public static void report()
{
String output;
System.out.println(" Your reort has been printed");
System.exit(0);}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks