Jeremy Donaldson

Greenhorn
+ Follow
since Jun 21, 2001
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 Jeremy Donaldson

Thanks for the message. I've since been able to set my variables and everything seems to be working correctly. However, I'm not familiar with the RI server that you made mention of, did that come packaged with the download and how would that be used.
Thanks,
Jeremy
I've recently downloaded the J2EE framework and have begun working through some tutorials. I've tried to compile some EJB's but with no success. I've tried setting my classpath and path variables but again with no success. I've reviewed other threads illustrating what to do. But I was hoping someone would please give me detail instructions as to what variables to set and when? Again I'm using Windows 2000 professional.
Thanks,
Jeremy
nevermind I got it figured out, thanks again
22 years ago

Thanks Richard. I've done the very same thing but once I reprint the values it is not sorting them like it should. It still just appears in the order that the values where entered into the ArrayList.
22 years ago
I'm working through the exercises from the cattle drive and I'm working on Assignment OOP-3. It says to use the collections class to sort my text. I'm not quite sure how this is done when you don't actually create an instance of a collection. How do I call upon the methods for this class in order to sort data that I have with in an ArrayList. Any hints or tips would be great.
Thanks! Here is my current code snippet.
[Cattle Drive code deleted by Cindy]
I'm sorry, but posting Cattle Drive code is a no-no. You just need to think how to phrase your question generically so that us folks not in the "know" can try to help .
[This message has been edited by Cindy Glass (edited July 09, 2001).]
22 years ago
I was confused as to what element type you could populate the hashmap with. I'm assuming now that you can populate the hashmap with whatever variable you desire?
Thanks for the help.
Jeremy
22 years ago

I'm continuing to work on the Assignment OOP-2 and I've come across another delima. I'm trying to access the value of a hashmap by passing a string value. I've since found that it doesn't like that. It obviously requires an argument of type object. Why doesn't automatic promotion work in this case. Then I'm trying to return the value from the hashmap as an int. This again does not work and it doesn't allow me to cast down from an object to an int or Integer.
Here is a portion of the code that compiles but gives me the following runtime exception: java.lang.ClassCastException: java.lang.String
StringTokenizer st = new StringTokenizer(args[0], "-");
int howMany = st.countTokens();

if (howMany == 2) {

String first = st.nextToken();
String second = st.nextToken();
String third = args[1];

Object one = first;
Object two = second;
Object three = third;

Integer temp = (Integer)map.get(one);
int num1 = temp.intValue();
Integer temp2 = (Integer)map.get(two);
int num2 = temp2.intValue();

int num3 = num2+num1;

Integer temp3 = (Integer)map.get(three);
int num4 = temp3.intValue();

Any help is appreciated
Thanks,
Jeremy
22 years ago

Great thanks.
22 years ago

I'm working on the cattle drive on Assignment OOP - 2. My question is how do I take the following example:
String number = "thirty-two";
and covert that string into two:
String first = "thirty";
String two = "two";
I've looked at stringbuffer, string, and character classes but have yet to figure this out. Any hints would be appreciated.
Thanks,
Jeremy
22 years ago

Thanks for the hint. Here was my attempt. The requirements are expressed within the switch statement. I'm not quite sure how to capture the current date. Currently I'm posting just the time. Any additional help would be great.
import java.util.*;
import java.text.*;
class GeekWatch {

public static void main (String args[]) {

int x = Integer.parseInt(args[0]);
DateFormat timeFormat = DateFormat.getTimeInstance();
Date tf = new Date();
Calendar cal = Calendar.getInstance();
long mill = tf.getTime();

switch (x) {

case 0:

System.out.println("milliseconds since January 1, 1970: \t" + mill);
break;
case 1:

long seconds =mill/1000;
System.out.println("number of seconds since January 1, 1970: \t" + seconds);
break;

case 2:

long day = ((((mill/1000)/60)/60)/24);
System.out.println("number of days since January 1, 1970: \t" + day);
break;

case 3:

String time = timeFormat.format(cal.getTime());
System.out.println("current date and time: \t" + time);
break;
}
}
}
22 years ago
I'm working through the exercises from the cattle barn and I'm having trouble understanding how to complete the geek watch. Before they were deprecated I could use the date class to pull the exact information that exercise 8 requests. But using the Calendar class I'm not quite sure how to find the days, hours, minutes and seconds since January 1, 1970. If anyone could throw me a hint that would be great.
Thanks!
Jeremy
22 years ago