Results 1 to 16 of 16
Thread: Need help With program
- 02-20-2013, 08:32 AM #1
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Need help With program
Sorry , I am not good at java programming. I have a main class that has a menu system that loops, if 1 is pressed it is passed to another class which then passes the information to another class. So we have 1 main class (MAIN), one second class(SECOND) and 1 third class (THIRD). I have an array in the THIRD that the information that MAIN sends go into. When the loop in MAIN is started over, the program goes to THIRD and overwrite what is made in the array . Can someone please tell me how to fix this
- 02-20-2013, 08:52 AM #2
Re: Need help With program
Have a pointer in THIRD that tells you where to insert into your array. I reckon you always insert at array[0].
It's hard helping without seeing your code.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 09:02 AM #3
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
[edited out]
Last edited by Ramkiller1; 02-20-2013 at 03:05 PM.
- 02-20-2013, 09:12 AM #4
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
This is what I am trying to get done but having a hard time (yes i bet its easy for some of you). lol
- 02-20-2013, 09:13 AM #5
Re: Need help With program
Aha, your Company class only knows one Employee, which is overwritten every time. You need a List of Employees in Company.
Look at the UML: Company has an Employee array, which you have forgotten.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 09:20 AM #6
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
hmm so make the array in company instead , hmm and use get methods from employee to put the information in the array?
- 02-20-2013, 09:28 AM #7
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
- 02-20-2013, 09:31 AM #8
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
Can you tell me how do I get a return type of an object . On the sheet that has company methods, the return type of getemployee is employee
- 02-20-2013, 09:48 AM #9
Re: Need help With program
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Java Code:public Employee getEmployee(int employeeID){Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 01:33 PM #10
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
- 02-20-2013, 01:47 PM #11
Re: Need help With program
Loop over the array and compare IDs.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 02:03 PM #12
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
Ok, thanks for the info 1 last question, I would think the get Employee would return a string to the company class, how do i make the statement to return it
- 02-20-2013, 02:13 PM #13
Re: Need help With program
Look at table 4! getEmployee returns an Employee. And it's returned to whatever object called it.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 02:17 PM #14
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Re: Need help With program
Yea, thats the point, I dont understand, I dont understand what would come out when returned thus I dont no what kinda of return statement to make.
- 02-20-2013, 02:23 PM #15
Re: Need help With program
return employee;
Did you read the method tutorial I've posted before?Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 02:39 PM #16
Member
- Join Date
- Feb 2013
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
Workout program progression - Ways to make my Java program shorter/smarter?
By LasseA in forum New To JavaReplies: 4Last Post: 11-21-2012, 01:19 PM -
How to code a program to send messages to a chat program?
By josh2992 in forum New To JavaReplies: 2Last Post: 04-02-2011, 12:57 PM -
changing my program to array working program
By Chewart in forum New To JavaReplies: 39Last Post: 11-18-2009, 06:53 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks