reset password
Author Message
omizi
Posts: 22
Posted 12:40 Oct 05, 2014 |

I can not figure out how to do lab one to save my life I need HELP!!!!!! the whole read in the file into the application scope then create map thing is killing me please in need salvation. if u have code my email is troccobama@yahoo.com any help is appreciate.... my pride is shot on my knees .... show me the way

~~•In the servlet you can get the path to the exchange rates file using getServletContext().getRealPath("/WEB-INF/currency_exchange_rates.txt")

•In init(), read the exchange rates file and store the data in application scope. I suggest that you use a SortedMap<String,Double> to store the exchange rates, where the key of a map entry is the currency symbol and the value is Units Per USD.

 

cysun
Posts: 2935
Posted 12:47 Oct 05, 2014 |

As I told you in email, you need to review BufferedReader or Scanner, StringTokenizer or String.split(), and the collection classes in java.util package, particularly Map/SortedMap and List.

AndersonChristoph
Posts: 34
Posted 12:57 Oct 05, 2014 |

Just know that you are not the only one!  I have never been so frustrated in my life as I was on Friday morning!

ceejay562
Posts: 25
Posted 13:03 Oct 05, 2014 |
I used scanner to read the file, then I used string.split (" ") to an array of strings. Then you have to parse the strings numbers into double.
Anonymous
Posts: 166
Posted 14:25 Oct 05, 2014 |

There is no God.

Rinchan7
Posts: 56
Posted 15:59 Oct 05, 2014 |

Wait, there was a lab? Did the Monday/Wednesday class have a lab?

EDIT: Have you kept any of your old assignments from 202-203? Most likely there were several that required reading in files and you probably forgot because of the 3 month break (I gotta review too). Either way, I suggest Google, there were tons of people who asked that question before so help can be found online:

StackOverFlow [this site is really good, I use it a lot for examples similar to what I'm looking for]:

http://stackoverflow.com/questions/2788080/reading-a-text-file-in-java

**Is posting other examples of help like this allowed??

 

Last edited by Rinchan7 at 16:11 Oct 05, 2014.
omizi
Posts: 22
Posted 22:48 Oct 05, 2014 |

I Finished !!!!!!! thanks for your replies

nextmatrixman
Posts: 57
Posted 00:25 Oct 06, 2014 |

Hi guys, I'm often confused about these forum posts as I don't know what you guys are talking about. I assume you guys are not in Dr. Sun's class?

Last edited by nextmatrixman at 00:25 Oct 06, 2014.
Rinchan7
Posts: 56
Posted 00:26 Oct 06, 2014 |

My guess is he has more sections than just the Monday/Wednesday ones

suketupatel116
Posts: 1
Posted 11:17 Oct 06, 2014 |

I didn't receive any mail regarding reviewing anything for lab1!!