Steven Alvarez

Ranch Hand
+ Follow
since Nov 01, 2006
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steven Alvarez

I DON'T WANT SOMEONE TO WRITE THIS PROGRAM, I just need help.

The question goes as follows:


(Student Poll) Figure 7.8 contains an array of survey responses that is hard coded into the program. Suppose we wish to process survey results that are stored in a file. This exercise requires two separate programs. First, create an application that prompts the user for survey responses and outputs each response to a file. Use a Formatter to create a file called numbers.txt. Each integer should be written using method format. Then modify the program in Fig. 7.8 to read the survey responses from numbers.txt. The responses should be read from the file by using a Scanner. Method nextInt should be used to input one integer at a time from the file. The program should continue to read responses until it reaches the end of file. The results should be output to the text file "output.txt".



The part I need help in is understanding this part:


Use a Formatter to create a file called numbers.txt. Each integer should be written using method format.



Can I use the FileWriter class? Or do I have to use "Formatter" to write the file? If so, can you give an example of how to do so?

Also what does this part mean?


Each integer should be written using method format.



Thanks!!
14 years ago
anyone can explain what happens with the stack with these commands? Thanks.
15 years ago
Well I have a test on the JVM.

Does getstatic and getfield put the data from the object to the stack or the other way around?

Can you recommend any reading I can do for the JVM? Besides the spec?

I'm going to bed, maybe we can continue this later.
15 years ago
oh ok sounds good. But how does this relate to the stack? Thanks.
15 years ago
My question is what is getfield, putfield, getstatic, putstatic, and the difference?

From what I remember getfield and getstatic get a field from an object and puts it into the stack, and putfield and putstatic do the opposite. However getstatic and putstatic need the address of the object.

Am I on the right track?
15 years ago
anyone know how to fix it?
15 years ago
it works fine for typing END however

I also tried while (loop1 = true) and while (loop2 = true)
[ October 18, 2008: Message edited by: Steven Alvarez ]
15 years ago
I get the same thing with this :-/
here is the code:


15 years ago
So I have the following code:



My question is how can I break out of two loops. Because when you run this progam is asks someone to guess a number from 1 to 1000. Once they guess correct, it asks for then to type "yes" to continuue, and "no" to stop.

Currently when they say no, it breaks out of the inner loop and asks them to guess again. When it's suppose to end the program.

Then I tried:


But that doesn't work either. Thanks for any help.
15 years ago
I'm given those numbers and I have to make a tree.
15 years ago
I have the following numbers:
50 25 70 10 37 60 90 30 40

Did I get it right? Here is the tree:

15 years ago
lets say you have:

a b c d / + * f -



And you scan from right to left to solve the problem, is that prefix or postfix?

BTW I know how to solve the problem, just want to know if you scan it right to left, what type of "fix" is it?
15 years ago
The method where you choose a pivot and there are two sections. The first section where the values or less than the pivot, and the second section where the values are the same or greater than the pivot.
15 years ago
I assume the pivot can be 15 or 20. But how to trace it after that is very confusing. Can someone trace this for me? Thanks!!
15 years ago
I really need help tracing a quicksort. Can someone help? The numbers are:
20, 80, 40, 25, 60, 10, 15

Thanks!
15 years ago