Dustin Schreader

Ranch Hand
+ Follow
since May 25, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Dustin Schreader

Sorry, I found the problem I forgot to write out the entire thing: java -cp . Test. So it does work now. disregard the post.

Saptaparna Dhar wrote:Thank you for your assistance.
I have set the path as suggested and now I compile the program by simply typing javac <classname>.java

Mr. John, the output which I got by typing java in the command prompt is--



I have a related issue. I am getting the above message and I have entered the command:

Why does this screen appear in the windows command prompt and what can I do to run my program. I created a simple hello world program and used:

and I got the output Hello world, so it must have executed fine actually the same thing is happening to my hello world program too. I do also have a jar file that I needed for jsch-0.1.48.jar in the same folder as the java and .class files. I'd Also like to mention that I ran this in eclipse and it works just fine. I've never used the command prompt to execute java before. Thank you!

10 years ago
I ended up doing this and it worked.. sort of.

The problem is the next part of my code is picking up the letter x that is typed in last to end the while loop and runs the last else statement to throw back x is not an option!
10 years ago
I've created a do while loop that does insert items into an array list like I want it to but the problem is the output to console. I want the user to enter items into an array so I have a prompt like so:



As you notice it does not print Enter a[2]: to the correct part of the screen, it's like it skips the second iteration to print the prompt yet it still stores to in array[2]. Here is my code:

10 years ago
I'm trying to get characters from or actually just single letters from an arraylist. Am I able to use charAt on an array list, I'm getting an error when I try it: cannot find symbol on lines 73, 75, 77, 79. Should I use substring instead?
10 years ago
The only problem with that is when I want to create an ArrayList<Patient> patientList.... from the CSV file the scanner reads in the arraylist does not except the data from the CSV file because it's a string. I get an error saying cannot find symbol method Patient(java.lang.String).
10 years ago
I wrote my own patient class and I am able to pass strings to the constructor. I just couldn't figure out how to convert string to generic type.. which I still don't really understand but someone had a similar code for the conversion. I think it was a little to much for me to handle. I'm just trying to read a string from a text file and insert that into an arraylist<Patient> and I couldn't figure out what to do to convert it.
10 years ago
Found a conversion example and slightly modified it. I don't understand why they would use interface but I got it to compile. Thanks for the help everyone!
10 years ago
Netbeans threw the logger automatically since I needed a try catch so I haven't had time to mess around with that yet. I wrote down pseudo code of all the classes. I have created a person class, a physician class, a patient class, and a person interface all methods having no more than one variable except the constructor. My addPt method looks cleaner already I think. I have looked through oracles class arraylist, tutorials on generics. I didn't know oracle had tutorials on conversions I will look those up now. Thank you!
10 years ago
Ok I've been doing some reading and found out a little more about generics and arraylists and scanners. Since patientList is an ArrayList of type <Patient> I should be able to do add(E e) or in my case patientList.add(Patient (s.next())); and since next() from the scanner returns a String I should be able to say that s.next() string is of type Patient correct? Well I guess it's not correct because I get the error cannot find symbol method Patient(java.lang.String) on line 7. I don't understand why it wants to see it as a method instead of making s.next() type Patient.
10 years ago
I think I made progress but still no go with error line 7. Cannot find symbol variable next location variable s of type java.util.scanner.
10 years ago
Hello,
I'm getting an error when I try to add an element to an ArrayList from my Scanner and I think it has something to do with scanner s not being of type <Patient>. Am I right, how do I fix it? Error line 7.
10 years ago
So since I had a an array of arrays previously and now I want to use an arrayList it seems easy enough to add more and more elements to an ArrayList but how do I sort through the list like i did when I was using a for loop to sort through the array of arrays? It seems like I'd be sorting through each entire string of combined variables created by my patient class when, let's say I just wanted to compare against the code of the pt to do a search on them not the code, name, physician, floor, and time.
10 years ago
So since I had a an array of arrays previously and now I want to use an arrayList it seems easy enough to add more and more elements to an ArrayList but how do I sort through the list like i did when I was using a for loop to sort through the array of arrays? It seems like I'd be sorting through each entire string of combined variables created by my patient class when, let's say I just wanted to compare against the code of the pt to do a search on them not the code, name, physician, floor, and time.
10 years ago
Also, I've been trying to look up more on "this" I learned it a while ago in class and I'm still confused as to how I'd use it but Winston gave it in this example.

is this.code referring to the private int code; at the top of the class that that it can differentiate between the parameters of the method patient and the class variables? And if that's correct is that the only reason this. is used, to differentiate between variables?
10 years ago