Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stuck - Extra Green Greenhorn  RSS feed

 
Spencer Armand
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am extremely new to Java. I am also a firefighter/EMT and I am wanting to make applications for our department. First I am trying to make an application to keep a record of our members. So I made the attached class, then made a new class (AddMember) to add a new member. I'm just really stuck and need help on how to proceed.

Member Class



AddMember Class
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

One thing first, when you post code, be sure to UseCodeTags (that's a link). I've added them for you this time.
 
Spencer Armand
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great thank you! I got the message to do this, but I'm posting from my phone, and did not see the option. Guess it was only visible on the full web version. Thank you again!

Regarding my initial post, any suggestions/guidance?
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what would you like the program to do, in plain English?
 
Spencer Armand
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ultimate goal is for to make an application for my department that does multiple things. The part I am working on now is a personnel management system. I want to input our department members (FD number, first & last name, phone number, email, and whether they are active or not). Then be able to retrieve and/or modify the information of our members and add new members as needed.
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this going to be a desktop application or a web application? If desktop, is it going to have a GUI or a command line interface? If you're not sure, go with a desktop application and a command line interface.

Next, do you want the information to persist? That is, when you shut down the program, should the entered data still be there? Then you will need a database. Do you know any SQL?

Just to practice, you can create the program without a database. Now think about how you want your users to interact with the program. You will probably want your users to be able to Create, Read, Update, and Delete (CRUD). How should they do this? Maybe with a printed menu?



I hope this gives you some things to think about how the program should work. There is much more.
 
Spencer Armand
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For now a desktop application and I do want the application to retain all entered data. For now I'm fine with a very basic GUI. I know nothing about databases. I would like a CRUD menu. This is all very new to me.
 
Sachin Tripathi
Ranch Hand
Posts: 368
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as your application is concerned, you might want a database at the backend,where once entered information gets stored.

You will be needing to know a lot of things, if you don't know them already:
Database connectivity
SQl
GUI creation
 
Spencer Armand
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know squat about any of that, except a little GUI. I've made a GUI class by itself, but don't know how to incorporate it into a program.

Will the database go at the end of my Member Class or do I make a separate class?

Thanks for all the feedback guys!
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

You have to walk before you can run. Start small. Running a database is a skill in its own right, quite different from programming. I am not sure whether you should create your program first or your database first. But I am sure of two things:-
  • 1: You should create the database, program and GUI separately from each other.
  • 2: You should create the GUI last.
  •  
    Spencer Armand
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yeah ha ha, I understand databases are more on the advanced side. But I am a quick study and I like the challenge. I rewrote my Member class to include more characteristics (yes, I know its a lot) and I'm posting it below. I understand this class "defines" my object "member." I will need to create a databases and a GUI class (some knowledge). I plan to call the database "FDPersonnel," will this interfere with my code since my project name is also "FDPersonnel?" I will then create a table in the new database called "fdmembers." I downloaded the MySQL Workbench, the java connector file or driver (can't remember the name) and have downloaded the community server program (300+MB) and have access to the command prompt. I just need someone to steer me on the right path. I have my object defined, now what is next?


     
    Liutauras Vilda
    Marshal
    Posts: 4638
    316
    BSD
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Before you go any further. There is no need to confuse your reader and yourself from the very beginning.

    1. Remove comment "//First name" next to the variable "name1" and change variable name itself to "firstName". Then do the same with the rest variable names you have (give meaning names, and remove comments).
    2. Remove comment "//First name" right above method signature and change method name from "getName1()" to "getFirstName()". Then do the same with the rest of methods.
     
    Spencer Armand
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I apologize for that. Here are the corrections. What's next?

     
    Liutauras Vilda
    Marshal
    Posts: 4638
    316
    BSD
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    1. "import java.util.Date;" you're not using this class. Consider removing it.
    2. Have 1 empty line in between different methods, so human eye could distinct methods from each other.

    3. How will you enter and where will you store all allergies?

    4. What are credentials in this context? Think of checks you might need here before you set (if needed).

    4. Have you tried to compile your class? Does it compiles?
    5. Did you write Tester class where you could create a Member class instance and try all methods?
     
    Spencer Armand
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    All of these fields will be text entry fields, JTextField if I remember correct. Credentials in this context will be a regular text field where we can list any credentials (certifications, licenses, etc). In Eclipse, I have no errors or red marks appear anywhere in the code. I am in the process of learning how to make a test class. All of these variables are to be stored in a database and be persistent. The import statement was the only red flag Eclipse had until I added that import statement. This is the only class I have so far. Again, I am reading up on how to create test classes. I also have a rough draft started, really just a primitive idea, for the GUI.
     
    Liutauras Vilda
    Marshal
    Posts: 4638
    316
    BSD
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You can try your Member class by creating tester class

    Look for information in general about data validation before it gets inserted to database if you said you're going to do that.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!