Hello I am trying to take a multi-deminsional array[ ] [ ] (2D (if you will)) and set a varriable through a classes public setter. //some of the fields private int request_id; private String time_stamp; private int session_id; private int client_intf; private int server_intf; // many more... // Some Getters public int getRequest_id() { return request_id; } public String getTime_stamp() { return time_stamp; } public int getSession_id() { return session_id; } public int getClient_intf() { return client_intf; } public int getServer_intf() { return server_intf; } // some setters public void setRequest_id(int request_id) { this.request_id = request_id; } public void setTime_stamp(String …

Member Avatar
Member Avatar
+0 forum 4

I need everything to come out as a double rather than an int. I dont know how to do this other than creating lots of variables! Is there a way i can convert? my counter is causing the problem but i dont think theres another way to do it.The program simply prints 10 peoples wages, in an array, then it prints the bonus based on a per cent, then the total inc bonus!! and stores the new total in a new array, called total[]. .....any help would be appreciated public class Salary { public void calcSalary() { int wages[]={50000,40000,30000,20000,10000,60000,35000,46000,23000,19000}; final …

Member Avatar
Member Avatar
+0 forum 8

I have this progrom which is compiling and running.Only Iam tryin to understand how to change the action listener Next en previous such that,If i have 5 employees in record it when you reach the last employee in record the Next and previous buttons should be disabled.please advise here is the action listener part of the code. [CODE]public Employee1(EmployeeDataSet employees) { this.numberOfEmployees = employees.getEmployeeCount(); this.employees = employees; } public void loadEmployeeInGUI(Employee e) { // set text field with name Q1Field.setText(e.getName()); // set text field with title Q2Field.setText(e.getName()); // set textfield with salary Q3Field.setText(String.valueOf(e.getSalary())); } public void actionPerformed(ActionEvent x) { if …

Member Avatar
Member Avatar
+0 forum 4

Hey guys, Well I had a few questions, so I have an employee Database with id,fname,lname,dep and I wasn't sure if I should do and Employee class whit constructor and what not, and make the class read the information form the Database and then create and ArrayList<employee> and fill it up and have my Table java read from my class with the arraylist or should I just fill up the table directly from the returned queries. I really dont know to do the last part, but i have done various little projects with Arraylist<Type> and things like that. Do you'll …

Member Avatar
Member Avatar
+0 forum 5

the program runs but fails to read the double word states (e.g New Jersey). am getting the error.java.lang.NumberFormatException: For input string: "Hampshire" [CODE] import java.text.DecimalFormat; import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.nio.CharBuffer; import java.awt.*; //import java.awt.event.*; import javax.lang.model.type.ArrayType; import javax.swing.*; import javax.swing.event.*; public class PJ5 extends JFrame implements ListSelectionListener {String []States = new String[100]; double []statetax = new double[100]; double sales; JPanel p1; JList StateList; JTextField salesField; private JTextField taxField; public static void main(String []args) { PJ5 x = new PJ5(); x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); x.setTitle("Sales tax calculator"); x.setSize(350, 250); x.setVisible(true); } // main public PJ5() // constructor { String s; StringTokenizer …

Member Avatar
Member Avatar
+0 forum 1

So i had to write a program that uses these functions to add, subtract, multiply and see if the numbers equal each other. and also You must create a way to keep track of the relationships between friends, the spouses, the siblings, the children of the men and women. attached is the requirements. [ICODE]import java.util.Scanner; public class lhlFamily { char[][] mem=new char[100][100]; int cnt; public lhlFamily() { Scanner key = new Scanner(System.in); System.out.println("Enter count of members"); cnt=Integer.parseInt(key.nextLine()); int i,j,k; for(i=0;i<cnt;i++) { for(j=i+1;j<cnt;j++) { System.out.println("Enter relationship of "+i+" and "+j+" Enter 'n' if not directly connected"); String r=key.nextLine(); mem[i][j]=r.charAt(0); } } …

Member Avatar
Member Avatar
+0 forum 4

Can you help me with this? Our instructor told us that we are going to StringTokenizer and he didn't told what is a StringTokenizer or has not been discussed. Can you add also the comments why that code is all about? Many thanks, Jerick PROG 131 – Computer Programming SPECIAL PROJECT 1. Create a notepad file and save it as Students.txt and type in the following texts(LastName_firstname, idno, year level, department/college name): Potter_Harry,2010-0724,1,SCS Granger_Hermione,2009-0725,2,SCS Weasley_Ron,2008-0726,3,CASS Malfoy_Draco,2007-0727,4,CSM Snape_Severus,2007-0728,4,CED 2. Create a procedural java program and save it as Student_Schedule.java. Your program should ask the user to enter the student’s ID no. …

Member Avatar
Member Avatar
+0 forum 1

Can someone help me with my homework? my teacher asked us to create a program that lets the user to input 5 integers and sort it using bubblesort. i have already write the code but its not the output that i expected. heres the code: [CODE] import java.util.Scanner; public class bubble { static final int arraySize=5; public static void main(String[] args) { Scanner scan=new Scanner(System.in); int[] list=new int[arraySize]; int i,x; bubbleSort(list,arraySize); for(x=0;x<arraySize;x++){ System.out.print("Enter a number: "); list[x]=scan.nextInt(); } System.out.println("After sorting, the list elements are:"); for(i=0;i<arraySize;i++){ System.out.print(list[i]+" "); } System.out.println(); } public static void bubbleSort(int list[], int listLength) { int temp; …

Member Avatar
Member Avatar
+0 forum 2

Hey guys :) I'm making a code and testing it in drjava but at this stage there is just one function I am having trouble with. Here is my code so far [code=java] import java.util.ArrayList; class Player { //instance fields, a name, a place, and an inventory String name; LocationID place; ArrayList<ItemID> inventory; //constructor function for creating a new player //sets a name and a default location Player(String playername) { name = playername; place = LocationID.BEDROOM; } //an accessor method to return the location LocationID location() { return place; } //another accessor method to return inventory ArrayList<ItemID> tools() { return …

Member Avatar
Member Avatar
+0 forum 3

K ILL NOT REPEAT THIS AGAIN....Send me d coding...

Member Avatar
Member Avatar
+0 forum 6

Hi, I am just trying to figure out how to access some data. Currently it is stored in a spread sheet in the following form........ [CODE] 8/11/09 9/12/09 .... mm/dd/yy name score score .... score name2 score score .... score [/CODE] there will be many names (and more may be added at any time) also dates and scores will be added throughout the year for each name. I will need to read the name with the date and score in order to do some calculations with the scores and print various reports and statistics. Because of the fluidity of data …

Member Avatar
Member Avatar
+0 forum 1

The End.