Results 1 to 11 of 11
Thread: Help. two text files
- 10-05-2010, 07:20 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
Help. two text files
Hello, I have problem i need to do this project.
"We have a text-file list of products:
Name, quantity received, quantity sold, date and time.
File of the same brand name can be repeated.
The second is a text file, we can have a full trade price list:
Name, price, date.
Need to make output list.
Name, price, quantity sold, date
Product's name in alphabetical order."
please help to do it in Java Eclipse
- 10-05-2010, 07:38 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Well, what do you have? We are, certainly, not going to it for you.
- 10-05-2010, 07:44 AM #3
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
sure, I have this. One file working but how add another?
import java.io.*;
import java.util.*;
public class pirmas {
private Scanner x;
public void openFile (){
try{
x= new Scanner (new File("pirmas.txt"));
}
catch (Exception e){
System.out.println("no file");
}
}
public void readFile(){
while(x.hasNext()){
String a = x.next();
String b = x.next();
String c = x.next();
String d = x.next();
System.out.println(a+ " -name");
System.out.println(b+ " -quantity received");
System.out.println(c+ " -quantity sold");
System.out.println(d+ " -date and time");
}
}
public void closeFile(){
x.close ();
}
}
- 10-05-2010, 07:48 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
By opening and reading another?
Come on man. You are not even trying. I can about guarantee that this code is one of two things, those being
1. Something you just now copied
or
2. A previous homework assignment that you did in the same way you seem to be attmpting to do this one, by having someone do it for you.
- 10-05-2010, 07:50 AM #5
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
yeah, you got me. But you still can help me
- 10-05-2010, 07:52 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Yes I can. Once you actually start trying I will start to give you hints as to what you should be doing when you do something wrong. Doing it for you, though, is not helping you.
- 10-05-2010, 07:59 AM #7
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
its be awesome if you help me.
How to write that he output me and second file. I just first month of study Java, pascal didint count.
public class tadas{
public static void main (String [] args){
pirmas r = new pirmas();
r.openFile ();
r.readFile ();
r.closeFile ();
}
}
- 10-05-2010, 08:01 AM #8
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
I give up.
Edit: I'm sorry, I'm truely sorry, but if that is trying then maybe what you should really be doing is practicing the phrase "Would you like some fries with that?"
- 10-05-2010, 08:02 AM #9
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
so that a good news then
- 10-05-2010, 08:04 AM #10
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
- 10-05-2010, 08:09 AM #11
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Reading text files
By SuitMyPants in forum New To JavaReplies: 2Last Post: 09-27-2010, 02:39 PM -
Reading In Text Files
By Dukey in forum New To JavaReplies: 4Last Post: 04-04-2009, 11:53 PM -
working with files (text files)
By itaipee in forum New To JavaReplies: 1Last Post: 02-24-2009, 11:38 AM -
Behaving text files like binary files
By Farzaneh in forum New To JavaReplies: 2Last Post: 08-27-2008, 03:20 PM -
Text and image files within jar files
By erhart in forum Advanced JavaReplies: 8Last Post: 01-19-2008, 04:43 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks