Andres John

Ranch Hand
+ Follow
since Jun 07, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andres John

I just wondering about the OCPJP 7 Exam Simulator and OCPJP 7 Upgrade Exam Simulator that i have never heard about it, i don't know if this softwares is good or bad, due to the fact that i have never heard about this person before, James Peterson, nor we knows about his books. also index card is no included if we are away from the pc or mac to reviews the exam. sorry about my grammar.

Tony Docherty wrote:

40 the position of the match is 16


Sorry but that makes no sense to me. What is this algorithm supposed to do and what does it actually do?


Sorry for the late reply
this program support to do a recursive method or recursion, it actually sort it the number from lower to high using fastsorting (if you already read the comments)
11 years ago
The code is working fine but there is some problem in the algorithms of this problem like i wants a match to be equal to 15 but instead is give me 16 somehow, here is the code:

output:
1 2 3 3 4 7 7 9 10 10
16 17 18 18 19 19 20 20 21 21
21 25 27 27 29 30 31 36 38 39

40 the position of the match is 16
11 years ago

Campbell Ritchie wrote:And why are you using a tokenizer, which has been regarded as legacy code for over ten years?

sorry for the later reply
because my prof ask me do it, i anyhow that was a option (either use split or tokoz)
11 years ago

Tony Docherty wrote:
You have a semi colon at the end of the line so this line repeats until FileName is null and then the rest of the code executes.


ok thank now is working
11 years ago

Jesper de Jong wrote:The stack trace tells you that a NullPointerException occurs in the constructor of StringTokenizer. The API documentation for the constructor of StringTokenizer says:


public StringTokenizer(String str, String delim)

...

Throws: NullPointerException - if str is null


Most likely you are passing null to the constructor of StringTokenizer.



that what i did here:

String FileName="C:/Users/Desktop/file.csv";
try{
BufferedReader read = new BufferedReader (new FileReader(FileName));
StringTokenizer str= null;
int space=0, TokenN=0;
while ((FileName = read.readLine())!=null);

{
space++;
str = new StringTokenizer(FileName,",");
while (str.hasMoreTokens())
{.....

still get the error
11 years ago


{ TokenN++;
System.out.println("Space "+ space+ " tokenizer "+TokenN+"token :"+str.nextToken());
}
TokenN=0;
}
}
catch (FileNotFoundException e){
e.printStackTrace();
}
catch (IOException e){
e.printStackTrace();
}
}
}
11 years ago

that this have some kind problem
11 years ago

I don't get it why this code isn't running right, because the methodology seem to right. anyhow this what i get when i run it


11 years ago
I don't get what my prof mean by this :
-Read one line at a time and place into a new row of a two dimensional array called grades (file that he send me ).
-You can use split to separate the string tokens into a one dimensional array or you can the java tokenizer to separate based on comma delimiter
-In reading the file you will encounter exceptions due to the blank fields.
-create a new .csv file with the same data and a new column that contains the average of the three grades as a double also, the new file should replace all blanks with zeroes.
i'm not asking you guys to created a java program for me rather i need a sample of this ideas. like oracle's sites that explain some of this idea that i still don't get.
11 years ago

Kemal Sokolovic wrote:Well, you might review the tutorial I gave you in the previous post. Also similar topics were covered couple of times here at the forum, so if you search a bit you can find a lot of information (like this).



thank you for the link
11 years ago

Kemal Sokolovic wrote:Do you understand the concept and purpose of abstract classes?


I think im not familiar with that yet, perhaps can you explain it
11 years ago
the only that it seem for me to work only using the abstract only in point and just leave the circle and cylinder without a abstract
in which will look like this
output is this
3.141592653589793
Please select from the menu below
1. Instantiate a Circle
3. Instantiate a Cylinder
Enter your choice

i guess i can only use abstract in parent or the head of the class which is the Point
11 years ago
this kind of error and i already indicated with the arrow (=>)

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
c cannot be resolved to a type
Cannot instantiate the type Cylinder

at oops.Test.main(Test.java:53)
11 years ago
The prof. ask us to use abstract class for this kind of program but it seem that i can't test it.
this is my java program



and the error that i have is here





11 years ago