i am a new user here and and was wondering if anyone could help me with a program that i am writing. i have it most of it writen its but need to put it into classes. i just started to learn java so this stuff is new to me
if anyone can help please let me know.
thank you
this is the basic overveiw of the program i am trying to write
:
i need Create an employee class with data members:
name, department number, employee number and salary
Derive a class student employee from the employee class.
student employee data members:
grade point average & accumulated hours
The input should include name, department number, employee number, salary, grade point average and accumulated hours.
In addition, after all the data has been entered, i need to sort student employees by name.
and Store the valid student employee records in an array of student employees
also, Store the invalid student employee records in an array of student employees.
what the program does
Reads in name, department number, employee number, salary, grade point average and accumulated hours.
Validate the values in a method and displays unique error messages.
Count the number of good records, bad records and total records.
Display the average of the salaries in the good records.
When the user has entered 5 records, display the records in the arrays sorted by name.
these
Ranges:
name 1 - 10 characters
department number valid range : 1 -10
employee number valid range : 1 - 100
salary valid range : 1.0 - 999.99
grade point range : 0.0 - 4.0
accumulated hours: equal to or greater than zero
i am helping out a freind that needs this program to work, i am having some trouble
i have this program working without the use of classes and sorts so if anyone can help and would like to see my code please let me know
any help would be apprecaited thank you
thank you again
Last edited by dante27; Dec 1st, 2004 at 03:52 PM.
AppDemo - main is located here, basicall this is where processing is done. ConsoleInput - A class used to get the input from the console. To make encapsulate the acquisition of values... makes the code cleaner Employee - the superclass StudentEmployee - the class which extends Employee ValidRange - A class that just holds the valid ranges.. I just made this so as to lookup one location for all the constants needed. Cell - An implementation of a Singly-linked list whose first element is empty... empty so that manipulation like addition is easier.. lesser code to do.
hello,
thank you for the program. it works great i do have some questions?
i do have a some questions if you don't mind, i was wondering if there is anyway to make the program with out using the consleInput? if its possible? don't worry if its a bother. also i not really sure what exactly the code for cell does besides leave the first space empty is that mainly it?
well i thank you again for your time
also if anyone else has worked on this and did it a different way i would apprecaite it if you could post your code up, just because i new to java i would like to know the different ways that this can be done or approched .
If I were you I'd keep the consoleInput class as it's a good way of seperating it from the rest. Besides, it really doesn't matter if it's there or not to the user, only the programmer, in which case I don't see why it should be a problem to you...
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
I have updated the Project I attached... and here it is.
It's using Swing... basically it is still the same. no classes
have been removed I just added Two:
AppDemoGui - the gui but the process is still within AppDemo class IncompleteDataException - an exception when the user tries to add incomplete information. so that AppDemo will be notified about the error
BTW... the listener for all the buttons is the AppDemo class.
The project can be run either using the GUI or the console that's why I didn't remove the other classes
Cell is still used since I haven't tried using LinkedList in java.util yet. . I just made one that is convenient for me. But you can have your own implementation.. the style I adopted from a code I downloaded from planet-source code.. so it all depends on how you want to code it. .. just make sure you understand and that the code works.
Invoke the class using the java interpreter:
to Run in Gui: java AppDemo
to Run in Console same as before output: java AppDemo console