-
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
-
Well, what do you have? We are, certainly, not going to it for you.
-
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 ();
}
}
-
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.
-
yeah, you got me. But you still can help me
-
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.
-
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 ();
}
}
-
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?"
-
-
Quote:
Originally Posted by
Sedas
so that a good news then
If you're actually practicing that phrase, yes.
-
I need just a bit help to get start, the rest I will do myself. But two text files for beginner its a really serious puzzle..