Results 1 to 11 of 11
  1. #1
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default 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

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Well, what do you have? We are, certainly, not going to it for you.

  3. #3
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default

    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 ();
    }
    }

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    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.

  5. #5
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default

    yeah, you got me. But you still can help me

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    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.

  7. #7
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default

    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 ();
    }
    }

  8. #8
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    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?"

  9. #9
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default

    so that a good news then

  10. #10
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Sedas View Post
    so that a good news then
    If you're actually practicing that phrase, yes.

  11. #11
    Sedas is offline Member
    Join Date
    Oct 2010
    Posts
    6
    Rep Power
    0

    Default

    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..

Similar Threads

  1. Reading text files
    By SuitMyPants in forum New To Java
    Replies: 2
    Last Post: 09-27-2010, 02:39 PM
  2. Reading In Text Files
    By Dukey in forum New To Java
    Replies: 4
    Last Post: 04-04-2009, 11:53 PM
  3. working with files (text files)
    By itaipee in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 11:38 AM
  4. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 03:20 PM
  5. Text and image files within jar files
    By erhart in forum Advanced Java
    Replies: 8
    Last Post: 01-19-2008, 04:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •