CS 1401 Homework #6

Date Assigned: Tuesday, February 22, 2005

Due Date: Thursday, February 24, 2005, before the beginning of your lecture section.

Goal: the goal of this assignment is to learn how to read from files, write into files, and do while loops in Java.

Assignment: In a country far-far away called Vietnam there is a currency called Dong. At present, 1 dollar is about 13,000 Dong. To avoid writing too many zeros, the government decided to introduce a new currency New Dong which is 10,000 times smaller. So, what used to cost 35,000 Dong will now cost 3.5 New Dong.

The old prices are contained, line by line, in a file old.dat. Write a piece of code that reads these prices line by line, divides by 10,000, and places the resulting prices into the new file new.dat.

For example, if the file old.dat had the following prices:

then the file new.dat should contain