Connecting Tech Pros Worldwide Forums | Help | Site Map

Please Help due in 45 min

Newbie
 
Join Date: Feb 2008
Posts: 1
#1: Feb 19 '08
I need to write a program that reads this from the text file

Expand|Select|Wrap|Line Numbers
  1. 4
  2. Katea
  3. Murray
  4. 3.75
  5. 9
  6. Matt
  7. Reese
  8. 2.89
  9. 11
  10. Liz
  11. Huntley
  12. 3.98
  13. 12
  14. Ken
  15. Black
  16. 2.99
  17. 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
Expand|Select|Wrap|Line Numbers
  1. public void menu()
  2.                {
  3.             char ch=30;
  4.                 char ch1=31;
  5.                 int l;
  6.                 for(int i=0;i<27;i++)
  7.                 {
  8.                   System.out.print(" ");
  9.                 }
  10.                 for(l=0;l<2;l++)
  11.                {
  12.  
  13.                 for(int j=0;j<38;j++)
  14.                 {
  15.  
  16.                   System.out.print(ch);
  17.                 }
  18.                   System.out.println("");
  19.                    for(int k=0;k<27;k++)
  20.                 {
  21.                   System.out.print(" ");
  22.                 }
  23.               }
  24.                 System.out.print(ch);
  25.                 System.out.print(ch1);
  26.                 for(int i=0;i<34;i++)
  27.                 System.out.print(" ");
  28.                 System.out.print(ch);
  29.                 System.out.print(ch1);
  30.                 System.out.println("");
  31.                 for(int i=0;i<27;i++)
  32.                 System.out.print(" ");
  33.  
  34.                 System.out.print(ch);
  35.                 System.out.print(ch1+" ");
  36.                 System.out.print (" 1. Enter new Students record           ");
  37.  
  38.                 System.out.print(" "+ch);
  39.                 System.out.println(ch1+" ");
  40.  
  41.                 for(int i=0;i<26;i++)
  42.                 System.out.print(" ");
  43.                 System.out.print(" "+ch1);
  44.                 System.out.print(ch+" ");
  45.  
  46.  
  47.             System.out.print (" 2. Display All Student records and GPA:         ");
  48.                 System.out.print(" "+ch);
  49.                 System.out.println(ch1+" ");
  50.  
  51.  
  52.                 for(int i=0;i<26;i++)
  53.                 System.out.print(" ");
  54.                 System.out.print(" "+ch);
  55.                 System.out.print(ch1+" ");
  56.  
  57.  
  58.             System.out.print (" 3. Search students by first name:      ");
  59.                 System.out.print(" "+ch);
  60.                 System.out.println(ch1+" ");
  61.  
  62.  
  63.                 for(int i=0;i<26;i++)
  64.                 System.out.print(" ");
  65.                 System.out.print(" "+ch);
  66.                 System.out.print(ch1+" ");
  67.  
  68.             System.out.print (" 4. Search students by last name:      ");
  69.                 System.out.print(" "+ch);
  70.                 System.out.println(ch1+" ");
  71.  
  72.  
  73.                 for(int i=0;i<26;i++)
  74.                 System.out.print(" ");
  75.                 System.out.print(" "+ch);
  76.                 System.out.print(ch1+" ");
  77.  
  78.  
  79.             System.out.print (" 5. Search searchstudents by GPA:");
  80.                 System.out.print(" "+ch);
  81.                 System.out.println(ch1+" ");
  82.  
  83.  
  84.                 for(int i=0;i<26;i++)
  85.                 System.out.print(" ");
  86.                 System.out.print(" "+ch);
  87.                 System.out.print(ch1+" ");
  88.  
  89.  
  90.                 System.out .print(" 6. Replace Student Record:             ");
  91.                 System.out.print(" "+ch);
  92.                 System.out.println(ch1+" ");
  93.  
  94.  
  95.                 for(int i=0;i<26;i++)
  96.                 System.out.print(" ");
  97.                 System.out.print(" "+ch);
  98.                 System.out.print(ch1+" ");
  99.  
  100.  
  101.             System.out .print(" 7. Delete Record:              ");
  102.                 System.out.print(" "+ch);
  103.                 System.out.println(ch1+" ");
  104.  
  105.  
  106.                 for(int i=0;i<26;i++)
  107.                 System.out.print(" ");
  108.                 System.out.print(" "+ch);
  109.                 System.out.print(ch1+" ");
  110.  
  111.  
  112.             System.out .print(" 8. Exit:                       ");
  113.                 System.out.print(" "+ch);
  114.                 System.out.println(ch1+" ");
  115.  
  116.  
  117.                 for(int j=0;j<27;j++)
  118.                 System.out.print(" ");
  119.                 System.out.print(ch);
  120.                 System.out.print(ch1);
  121.                 for(int i=0;i<34;i++)
  122.                 System.out.print(" ");
  123.                 System.out.print(ch);
  124.                 System.out.print(ch1);
  125.                 System.out.println("");
  126.                 for(int i=0;i<27;i++)
  127.                 System.out.print(" ");
  128.                 for(int i=0;i<38;i++)
  129.                 System.out.print(ch);
  130.                 System.out.println("");
  131.                 for(int i=0;i<27;i++)
  132.                 System.out.print(" ");
  133.                 for(int i=0;i<38;i++)
  134.                 System.out.print(ch);
  135.                 //Scanner input = new Scanner ( System.in);
  136.                  //int s;
  137.  
  138.                 int choice=0;
  139.                 String strChoice = JOptionPane.showInputDialog(null,"Pick your action");
  140.                 choice = Integer.parseInt(strChoice);
  141.                  //s=new input.nextInt();
  142.  
  143.                // SimpleComparator(int s) {
  144.                 switch (choice) {
  145.                         case 1:
  146.                         new_student();
  147.  
  148.                         break;
  149.                         case 2:
  150.                         display_allstudents();
  151.                                                                         dispay_gpa_average
  152.  
  153.                         break;
  154.                         case 3:
  155.                         search_by_first_name();
  156.  
  157.                         break;
  158.                         case 4:
  159.                         search_by_last_name();
  160.  
  161.                         break;
  162.                         case 5: 
  163.                        search_by_gpa();           
  164.                         break;
  165.                         case 6:
  166.                         replace_record();
  167.  
  168.                         break;
  169.                         case 7:
  170.                         delete_record();
  171.  
  172.                         break;
  173.                         case 8:
  174.  
  175.                         break;
  176.                          default:
  177.  
  178.                         break;
  179.                     //}
  180.                 //}
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.         }
  192.  
  193.            }

Ganon11's Avatar
Moderator
 
Join Date: Oct 2006
Location: New York, United States of America
Posts: 3,428
#2: Feb 19 '08

re: Please Help due in 45 min


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.
nomad's Avatar
Expert
 
Join Date: Mar 2007
Location: CA.
Posts: 570
#3: Feb 19 '08

re: Please Help due in 45 min


Quote:

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
Reply


Similar Java bytes