Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java project help (java sorting)
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nezura




PostPosted: Tue Jan 11, 2005 9:53 pm   Post subject: Java project help (java sorting)

code:
import java.io.*;

class menuh
{
    public static void main (String[] args) throws IOException
    {
        BufferedReader in = new BufferedReader (new InputStreamReader (System.in));


        int x = 0;
        String line;
        int limit = 0;



        BufferedReader stdin = new BufferedReader (
                new InputStreamReader (System.in));

        mainLoop:

        while (true)
        {
            System.out.println ("");
            System.out.println ("1.  Input Information");
            System.out.println ("2.  Change Information");
            System.out.println ("3.  Organize Information");
            System.out.println ("4.  Exit");

            char choices = in.readLine ().charAt (0);

            switch (choices)
            {

                case '1':
                    System.out.println ("Input Information");
                    System.out.println ("----------------------");
                    System.out.println ("Please choose a format to input information");
                    System.out.println ("1. Enter data from CVS file");
                    System.out.println ("2. Enter data manually");
                    char option = in.readLine ().charAt (0);

                    switch (option)
                    {
                        case '1':

                            line = stdin.readLine ();
                            limit = Integer.parseInt (line.trim ());
                            String names[] = new String [limit];
                            String sex[] = new String [limit];
                            int number[] = new int [limit];
                            int Cnumber[] = new int [limit];
                            String email[] = new String [limit];
                            String address[] = new String [limit];

                            System.out.println ("You have chosen to enter from a CVS file");
                            public static void read () throws IOException //reading from a file
                            {
                                String fileName = "C:/text.txt";
                                BufferedReader fileIn = new BufferedReader (new FileReader (text.txt));

                                for (int i = 0 ; i < limit ; i++)
                                {
                                    string = fileIn.readLine ();
                                }
                            }
                            break;



                        default:
                            System.out.println ("Incorrect choice, please choose again " + choices);
                            break;
                        case '2':
                            System.out.println ("You have chosen to enter manually");
                            System.out.println ("Please enter the number of people in your address book");


                            for (int q = 0 ; q < limit ; q++) //stores entries for names
                            {
                                System.out.println ("Enter Name " + (q + 1) + ": ");
                                names [q] = stdin.readLine ();
                            }

                            for (int q = 0 ; q < limit ; q++) //stores entries for sex
                            {
                                System.out.println ("Enter Sex " + (q + 1) + ": ");
                                sex [q] = stdin.readLine ();
                            }

                            for (int q = 0 ; q < limit ; q++) //stores telephone number
                            {
                                System.out.println ("Telephone Number " + (q + 1) + ": ");
                                number [q] = stdin.readLine ();
                            }

                            for (int q = 0 ; q < limit ; q++) //stores cell number
                            {
                                System.out.println ("Cell number " + (q + 1) + ": ");
                                Cnumber [q] = stdin.readLine ();
                            }


                            for (int q = 0 ; q < limit ; q++) //stores address
                            {
                                System.out.println ("Address " + (q + 1) + ": ");
                                address [q] = stdin.readLine ();
                            }

                            for (int q = 0 ; q < limit ; q++) //stores Email
                            {
                                System.out.println ("Enter email " + (q + 1) + ": ");
                                email [q] = stdin.readLine ();
                            }

                            for (int q = 0 ; q < limit ; q++) //displaying the information
                            {
                                System.out.println ("Name " + (q + 1) + ": " + names [q]);
                                System.out.println ("Sex " + (q + 1) + ": " + sex [q]);
                                System.out.println ("Number " + (q + 1) + ": " + number [q]);
                                System.out.println ("Cell Phone Number   " + (q + 1) + ": " + Cnumber [q]);
                                System.out.println ("Address " + (q + 1) + ": " + address [q]);
                                System.out.println ("Email" + (q + 1) + ": " + email [q]);

                            }

                            break;
                    }
                    do
                    {
                        System.out.println ("Press y to return to the main menu");
                        char quit = in.readLine ().charAt (0);
                        if (quit == 'y')
                        {
                            x = 1;
                            break;

                        }
                        else
                        {
                        }
                    }
                    while (x != 1);


                case '2':
                    System.out.println ("Edit Information");

                    break;
                case '3':
                    System.out.println ("Sort Information");

                    break;
                case '4':
                    break mainLoop;
                default:
                    System.out.println ("Invalid choice " + choices);
                    break;
            }

        }
    }
}





When i run it i get 18 errors, what is the problem? how do i fix it?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 11, 2005 10:07 pm   Post subject: (No subject)

you get a compiler that returns error messages, with a description of a problem and the line number. Then you read those messages and fix your semi-colons or whatever.

Eclipse is good
Nezura




PostPosted: Tue Jan 11, 2005 10:09 pm   Post subject: (No subject)

yea i know about those lines, but i really don't understand what's wrong at those lines

i use ready to program
Tony




PostPosted: Tue Jan 11, 2005 10:13 pm   Post subject: (No subject)

Nezura wrote:
i use ready to program

that's your problem right there. Anyone will tell you that Laughing
Nezura




PostPosted: Tue Jan 11, 2005 10:15 pm   Post subject: (No subject)

lol ..yea well that's what my school makes us use -_-"

so anyone can fix that code up? or perhaps lead me in the right direction?
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: