Please Help due in 45 min

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ivetcher
    New Member
    • Feb 2008
    • 1

    Please Help due in 45 min

    I need to write a program that reads this from the text file

    Code:
    4
    Katea
    Murray
    3.75
    9
    Matt
    Reese
    2.89
    11
    Liz
    Huntley
    3.98
    12
    Ken
    Black
    2.99
    11
    and puts it in a few arrays
    grade
    FirstName
    LastName
    Gpa

    the program also needs a capability to search those arrays
    // Search by first name
    // Search by last name
    // Search by Gpa

    and to provide an overall Gpa average
    and it needs to have a capabilty to add new students
    please help

    I already have the menu
    [CODE=java]public void menu()
    {
    char ch=30;
    char ch1=31;
    int l;
    for(int i=0;i<27;i++)
    {
    System.out.prin t(" ");
    }
    for(l=0;l<2;l++ )
    {

    for(int j=0;j<38;j++)
    {

    System.out.prin t(ch);
    }
    System.out.prin tln("");
    for(int k=0;k<27;k++)
    {
    System.out.prin t(" ");
    }
    }
    System.out.prin t(ch);
    System.out.prin t(ch1);
    for(int i=0;i<34;i++)
    System.out.prin t(" ");
    System.out.prin t(ch);
    System.out.prin t(ch1);
    System.out.prin tln("");
    for(int i=0;i<27;i++)
    System.out.prin t(" ");

    System.out.prin t(ch);
    System.out.prin t(ch1+" ");
    System.out.prin t (" 1. Enter new Students record ");

    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");

    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch1);
    System.out.prin t(ch+" ");


    System.out.prin t (" 2. Display All Student records and GPA: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");


    System.out.prin t (" 3. Search students by first name: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");

    System.out.prin t (" 4. Search students by last name: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");


    System.out.prin t (" 5. Search searchstudents by GPA:");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");


    System.out .print(" 6. Replace Student Record: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");


    System.out .print(" 7. Delete Record: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int i=0;i<26;i++)
    System.out.prin t(" ");
    System.out.prin t(" "+ch);
    System.out.prin t(ch1+" ");


    System.out .print(" 8. Exit: ");
    System.out.prin t(" "+ch);
    System.out.prin tln(ch1+" ");


    for(int j=0;j<27;j++)
    System.out.prin t(" ");
    System.out.prin t(ch);
    System.out.prin t(ch1);
    for(int i=0;i<34;i++)
    System.out.prin t(" ");
    System.out.prin t(ch);
    System.out.prin t(ch1);
    System.out.prin tln("");
    for(int i=0;i<27;i++)
    System.out.prin t(" ");
    for(int i=0;i<38;i++)
    System.out.prin t(ch);
    System.out.prin tln("");
    for(int i=0;i<27;i++)
    System.out.prin t(" ");
    for(int i=0;i<38;i++)
    System.out.prin t(ch);
    //Scanner input = new Scanner ( System.in);
    //int s;

    int choice=0;
    String strChoice = JOptionPane.sho wInputDialog(nu ll,"Pick your action");
    choice = Integer.parseIn t(strChoice);
    //s=new input.nextInt() ;

    // SimpleComparato r(int s) {
    switch (choice) {
    case 1:
    new_student();

    break;
    case 2:
    display_allstud ents();
    dispay_gpa_aver age

    break;
    case 3:
    search_by_first _name();

    break;
    case 4:
    search_by_last_ name();

    break;
    case 5:
    search_by_gpa() ;
    break;
    case 6:
    replace_record( );

    break;
    case 7:
    delete_record() ;

    break;
    case 8:

    break;
    default:

    break;
    //}
    //}










    }

    }[/CODE]
    Last edited by Ganon11; Feb 19 '08, 02:10 PM. Reason: Please use the [CODE] tags provided.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    This isn't a chat room, so you can't possibly expect an answer within 45 minutes. Also, we don't give out full solutions, we merely guide you to solving your own problems. We'd love to go through any specific issues you have if you can show us what you're attempted in order to solve them.

    Additionally, please don't post two threads on one topic. It doesn't get you an answer any faster - if anything, it slows the response down, because people don't know what has been posted in the second topic, and they might repeat information. So basically keep it to one thread per topic.

    Comment

    • nomad
      Recognized Expert Contributor
      • Mar 2007
      • 664

      #3
      Originally posted by ivetcher
      I need to write a program that reads this from the text file
      I don't think you're going to make it...
      anyway read up on FileReader class.

      nomad

      Comment

      Working...