NormR1 563 Posting Sage Team Colleague

What did Google give you?

NormR1 563 Posting Sage Team Colleague

An easy way to print the contents of an array is to use the Arrays class's toString() method to format the array for printing. For example:

  System.out.println("an ID here " + java.util.Arrays.toString(theArrayNameHere));
Starstreak commented: Oh, boy! You telling that tyo a beginner without explaininghow it works. tsk tsk! +0
NormR1 563 Posting Sage Team Colleague
NormR1 563 Posting Sage Team Colleague

@Starstreak If you are going to do the OPs work for him, you should also explain how the code you post works.

NormR1 563 Posting Sage Team Colleague

use standard naming conventions

Take the Main method
vs main()

NormR1 563 Posting Sage Team Colleague

try debugging the code by adding some println methods to the methods that the testing class's main() method calls to show what is happening in the code.

NormR1 563 Posting Sage Team Colleague

Please post the full text of the compiler's error messages so we can see what it is saying.

NormR1 563 Posting Sage Team Colleague

Your use of this in the first example has nothing to do with an interface. "this" is not needed there.
I don't know what the second example is trying to show. The compareTo method does not require a Comparable object.

joankim commented: I still dont know what you meant... Maybe explain it instead of pointing out my mistakes. +0
NormR1 563 Posting Sage Team Colleague

Are you trying to learn programming
or are you just looking for working code?

NormR1 563 Posting Sage Team Colleague

Why are you doing the OPs homework? You don't learn how to code by copying and pasting.

L Spoon feeding h r Text

NormR1 563 Posting Sage Team Colleague

That and $2 will get me a cup of coffee.

NormR1 563 Posting Sage Team Colleague

Who wrote the code that is posted? Ask that person how to create a new instance of a class.
Hint: use the new statement. It is used over 6 times in the program.

NormR1 563 Posting Sage Team Colleague

Your formatting is hiding your problem.
If you want to get better at Java I suggest that you use the recommended formatting for code. Formatting is important. It allows anyone to easily read the code and understand the nesting levels of the statements and to see what statements are inside of a loop and what statements are not in the loop.

I've said it 4 times now and I guess if you don't want to follow my suggestions there is nothing more I can do.

Good luck.

NormR1 563 Posting Sage Team Colleague

Another thing to improve the code: Use a variable to define the size of the arrays.
Do not hard code 80 and 79 and 39 all over the program.

Put these statements at the beginning of the class:

final static int NbrDigits = 10;          //<<<<<<<<<Set small for testing
    inal static int max = NbrDigits/2;    // What is max used for??? 
    static Scanner in = new Scanner("4\n4\n"); //System.in);
    static int multiplyend[] = new int[NbrDigits];

Use the length of the arrays to control for loops, not a hard coded number:
for(int l=79; l>=0; l--) //<<<<<<< Poor technique use array.length-1 here

aznjesse commented: not helpful at all +0
NormR1 563 Posting Sage Team Colleague

Could you preload the Scanner input by changing this line to have valid input.

static Scanner in = new Scanner("4 4\n"); //System.in);

For debug testing it is easier if the program doesn't have to ask for the input.
The correct input is provided every time without user intervention.

NormR1 563 Posting Sage Team Colleague

What do I need to do to make it work to display like the picture above?

Look at what your code does for each statement it executes. Play computer by tracking thru the logic using a piece of paper and a pencil writing down the values of the variables as each statement is executed.

Where are the '&' characters in your code? It will never print the '&' without some code to do that.

NormR1 563 Posting Sage Team Colleague

Sounds like high school algebra. Solving an equation with 2 unknowns.
A way would be a brute force nested looping program.

NormR1 563 Posting Sage Team Colleague

making this loop as long as you say yes

Where is the code for the loop?
All I see are some if statements?

NormR1 563 Posting Sage Team Colleague
System.out.println("tempStr=" + tempString.substring(j, j) + "<");

An id also helps you know which print out came from what statement

NormR1 563 Posting Sage Team Colleague

Call the add...Listener method for the component that generates the event.

NormR1 563 Posting Sage Team Colleague

Can you get definitions from Google for these terms and post them here for us to chose which ones make sense in the java programming environment?

NormR1 563 Posting Sage Team Colleague

Have you tried to compile your code? Does it give compiler errors?
You'll save some time if you compile it first before posting it with errors you don't know about.

NormR1 563 Posting Sage Team Colleague

I don't see any debugging println statements that would tell you how each variable changes and how the execution flow goes.
If you understand your algorithm and can see when your code is not following that algorithm by looking at how the values of variables change, then the output from the printlns should show you what is happening.

NormR1 563 Posting Sage Team Colleague

The import statement is a way of telling the compiler where to look for class definitions when the class is in a package. It saves you from having to code the full package name when you use a class.
Without the import java.util.Scanner; statement, you would have to code
java.util.Scanner in = new java.util.Scanner(System.in);

For this case maybe it doesn't save much, but if you use the Scanner class many times it can save a lot of typing and make the code a little less cluttered looking.


Note: The class name is Scanner not scanner. Case is important

NormR1 563 Posting Sage Team Colleague

You disagree that commenting code will help OPs learn about programming?

Code without comments is like you are trying to show off.
A lot of us care to help students learn programmning.

NormR1 563 Posting Sage Team Colleague

where it should change

I don't know about what should be changed. But in the code you posted, it looks like in the getRate() method is where it is changed.

The name: getRate() does not sound like a method that calculates salary.

NormR1 563 Posting Sage Team Colleague

the value of salary isn't changing throughout.

If you want it to change, you'll have to execute the code that changes it.

NormR1 563 Posting Sage Team Colleague

To print out the value of varible: var on the console, use: System.out.println("var=" + var);

To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

NormR1 563 Posting Sage Team Colleague
NormR1 563 Posting Sage Team Colleague

an easy solution for creating new arrays while runtime

use the new statement to create a new array. After creating them and filling them, they can be added to the ArrayList.

NormR1 563 Posting Sage Team Colleague

Why would I document code on a forum? That is asinine, lol.

One of the ideas on the forum is to teach students programming.
Good commenting style is not taught in schools.

Not all beginning students will understand posted code. Comments can help.

Do you consider good comments in a program important?

NormR1 563 Posting Sage Team Colleague

I never clutter my code up with useless characters

i guess that includes commenting your code also. I don't see ANY comments in the code you posted

NormR1 563 Posting Sage Team Colleague

how to java path

Can you explain what you are trying to do?
java is not a verb so your question does not make sense.
Did you leave some words out?

NormR1 563 Posting Sage Team Colleague

Absolutely I DONT KNOW. I'm not going to spend time trying to figure out the logic in your program. That is your problem.

NormR1 563 Posting Sage Team Colleague

Do an interesting and useful project. Something that you'll enjoy doing and that will be something that others could want to use and that will stretch your knowledge and experience.

NormR1 563 Posting Sage Team Colleague

Your mixing up the problem definition with the coding techniques.
Can you just do the problem definition and leave out the ArrayList stuff.

there are 3 records, 3 fields each

Does that say that the input file is limited to only 3 records.
And each record has 3 fields.
What are the three fields?

Where do your 5 classes come in?
One class for each record and one class for each field is only 4 classes?

NormR1 563 Posting Sage Team Colleague

structure that reflects that of a document stored in a plain txt file.

You don't define what the layout/structure is for the txt file.
What is the relationship between lines and tokens on a line with the objects you want to create?

ankilosado commented: he didn't seem to have read my post. +0
NormR1 563 Posting Sage Team Colleague

How can I stop a job if time is more than 60 seconds?

Use a Timer to call a method in 60 seconds.