• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Newbie to Java coding

sMiLeYz

Platinum Member
I'm taking an introduction class to java and I'm having issues with an assignment. I can honestly say that I'm not very good at coding, can anyone spare some time to help a noob?
It's really introduction stuff but I can't wrap my head around some concepts.
 
Go ahead and post your question. The members don't mind helping with homework, as long as they know it's homework and aren't just being asked for answers. Asking for help with fundamental concepts is not a problem.
 
My assignment so far:

"1. Prompt the user to enter a username and password. If either is incorrect, exit the program.
Otherwise, continue to process the program."

2. Read a file, and print information about the student ID."

I've written code that compiles and runs each process separately the separately but when I tried to put it together I can't.

I could actually use alittle one-on-one on this assignment. If possible 🙂
 
Can you:
  1. take the code from inside the main method of each original program
  2. stick each in a separate method in a new program, and
  3. have the new program's main call each of the other two methods?
 
Yeah. If you have two programs, and in the Main method of each you do what you need, all you have to do is something like this:

You have: Main1 & Main2. Main1 Prompts for username & password. Main2 reads from file & prints the student ID.

Since both of these are methods on their own, just make them a method in a third file, then call them both.

Main3 is your final file, which actually puts them together.

Main3 ()
{
User&Pass function() aka Main1;

ReadFromFile function() aka Main2;
}

in the same file, copy Main1 & Main2, rename them whatever(then call 'whatever')

Now that I re-read, this is exactly what Ken g6 said, just more visual.

Hope it helps, and feel free to ask if you don't understand.
 
Back
Top