Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 10th, 2005, 9:33 PM   #1
Cup O' Java
Newbie
 
Cup O' Java's Avatar
 
Join Date: Dec 2004
Posts: 18
Rep Power: 0 Cup O' Java is on a distinguished road
Homework Problem

// program reads lines from text file adds an inflation rate to it and then drops it into categories. the categories arent important or the format for now. all i want is the thing to read from a txt file and output another text file with the info that it read. once it reads the zero it breaks out.

=================
299.99
Television
159.95
Microwave Oven
512.22
Refrigerator
0
==================

import java.io.*;

class S1
{
public static void main(String[] args) throws IOException
{
final float INFLATION = .025f
FileReader file1 = new FileReader("G:\\java programs\\S1Data.txt");
BufferedReader inputfile = new BufferedReader(file1);
FileWriter file2 = new FileWriter("G:\\java programs\\S1Output.txt");
PrintWriter outputFile = new PrintWriter(file2);
String name;
float price;
price = new Float(inputFile.readLine()).floatValue();

while(price != 0)
{
price += price * INFLATION;
name = inputFile.readLine();
outputFile.println(price + " " + name);
price = new Float(inputFile.readLine()).floatValue();
}

inputFile.close();
outputFile.close();
}
}

problem is in line 8 FileReader file1 = new FileReader("G:\\java programs\\S1Data.txt");


i just cant figure it out. please obi won kenobi your my only hope

Last edited by Cup O' Java; Feb 10th, 2005 at 9:45 PM.
Cup O' Java is offline   Reply With Quote
Old Feb 10th, 2005, 9:51 PM   #2
Cup O' Java
Newbie
 
Cup O' Java's Avatar
 
Join Date: Dec 2004
Posts: 18
Rep Power: 0 Cup O' Java is on a distinguished road
ok nevermind Machiavelli went ape $hit on this little problem I had.
thanks man, cat knows his $hit
Cup O' Java is offline   Reply With Quote
Old Feb 11th, 2005, 6:28 AM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Heh. He does, at that. Just out of interest, what was the final product?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 15th, 2005, 11:08 PM   #4
Cup O' Java
Newbie
 
Cup O' Java's Avatar
 
Join Date: Dec 2004
Posts: 18
Rep Power: 0 Cup O' Java is on a distinguished road
oh im sorry im so late at getting back. since he helped me i didnt know anyone else was checking. but here it is.
Attached Images
File Type: jpg endresult.JPG (26.1 KB, 42 views)

Last edited by Cup O' Java; Feb 15th, 2005 at 11:12 PM.
Cup O' Java is offline   Reply With Quote
Old Feb 16th, 2005, 8:10 AM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Looks pretty sweet. Congrats.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:30 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC