joankim commented: I still dont know what you meant... Maybe explain it instead of pointing out my mistakes. +0
What did Google give you?
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 If you are going to do the OPs work for him, you should also explain how the code you post works.
use standard naming conventions
Take the Main method
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.
Please post the full text of the compiler's error messages so we can see what it is saying.
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.
Are you trying to learn programming
or are you just looking for working code?
That and $2 will get me a cup of coffee.
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.
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.
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
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.
[QUOTE]What do I need to do to make it work to display like the picture above?[/QUOTE]
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.
Sounds like high school algebra. Solving an equation with 2 unknowns.
A way would be a brute force nested looping program.
[QUOTE] making this loop as long as you say yes [/QUOTE]
Where is the code for the loop?
All I see are some if statements?
[CODE]System.out.println("tempStr=" + tempString.substring(j, j) + "<");[/CODE]
An id also helps you know which print out came from what statement
Call the add...Listener method for the component that generates the event.
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?
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.
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.
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
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.
[QUOTE]where it should change[/QUOTE]
I don't know about what [B]should[/B] be changed. But in the code you posted, it looks like in the getRate() method is where it [B]is[/B] changed.
The name: getRate() does not sound like a method that calculates salary.
[QUOTE]the value of salary isn't changing throughout.[/QUOTE]
If you want it to change, you'll have to execute the code that changes it.
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 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
[QUOTE] an easy solution for creating new arrays while runtime[/QUOTE]
use the new statement to create a new array. After creating them and filling them, they can be added to the ArrayList.