Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Final project will be a system to store data related to student members of a

ID: 3838373 • Letter: T

Question

The Final project will be a system to store data related to student members of a club. The program will read and write a file. The file will be read and stored into an array or ArrayList when the program starts and re-written when the program is exited. The file should store info about the student: number (the first student is 1 then each additional student is the next number), name, and email.

The program should allow the user to add a member, edit a member, delete a member, and list all members.

The following menus should be as follows:

Student Club Membership Database

Add

Delete

Edit

List

Exit

Action?

Student Club Membership Database

Add

Name: Matt Green

Email: mgreen14@wctc.edu

Press any key to return to Menu

Student Club Membership Database

Delete

Matt Green

Jeff Grissom

Jim Lombardo

Andrew Biewer

Which Student do you want to delete? __

Press any key to return to Menu

Student Club Membership Database

Edit

Matt Green

Jeff Grissom

Jim Lombardo

Andrew Biewer

Which Student do you want to edit? __

Change Name (Y/N): __

New Name: ___________

Change Email (Y/N): ___

New Email:___________

Press any key to return to Menu

Student Club Membership Database

List

Name            Email

----            -----

Matt Green      mgreen14@wtc.edu

Jeff Grissom    jgrissom@wctc.edu

Jim Lombardo    jlombardo@wctc.edu

Andrew Biewer   abiewer@wctc.edu

Press any key to return to Menu

Part C

Complete the program with File input and output.

Please answer this question and please let me know how to read and write file step by step .I don't know how to run this progarm. Thanks in advance

Explanation / Answer

/* Assuming Input.txt contains student data */

import java.io.*;
import java.util.*;

public class student {
   public String name;
   public String e_mail;
}

public class StudentMember {
     public static void main (String args[]){
        ArrayList<student> list = new Arraylist<student>();
        int choice;
        int found;
        String input;
        student stu = new student();
File file = new File("input.txt");
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        String line = null;
        while( (line = br.readLine())!= null ){
               String [] tokens = line.split("\s+");
               stu.name = tokens[0] + " " + tokens[1];;
               stu.e_mail = tokens[2];
               list.add(stu);
              
        }
        br.close();
        Scanner s = new Scanner(System.in);
        do {
          SyScanner s = new Scanner(System.in);
          Sysstem.out.println("1.Add");
          System.out.println("2.Delete");
          System.out.println("3.Edit");
          System.out.println("4.List");
          System.out.println("5.Exit");
          choice = s.nextInt();
          switch (choice) {
                case 1:
                    System.out.println("Enter name");
                    stu.name = s.nextLine();
                    System.out.println("Enter e-mail");
                    stu.e_mail = s.next();
                    list.add(stu);
                case 2:
                    System.out.println("Enter name");
                    stu.name = s.nextLine();
                    found = 0;
                    for (int i = 0; i<list.size(); i++){
                         if (list.get(i).name == stu.name){
                             found = 1;
                             list.remove(i);
                         }
                    }
                    if (found == 0){
                        System.out.println("No Records found");
                    }
               case 3:
                    System.out.println("Enter name ");
                    stu.name = s.nextLine();
                    for (int i = 0; i<list.size(); i++){
                         if (list.get(i).name == stu.name){
                             found = 1;
                             System.out.println( list.get(i).name + " " + list.get(i).e_mail);
                             System.out.println("Change Name(Y/N):");
                             if (s.next() == 'Y'){
                                 System.out.println("Enter new name:");
                                 list.get(i).name = s.nextLine();
                             }
                             System.out.println("Change EMail(Y/N):");
                             if (s.next() == 'Y'){
                                 System.out.println("Enter New Email:");
                                 list.get(i).e_mail = s.nextLine();
                             }
                         }
                    }
                    if (found == 0){
                        System.out.println("No Records found");
                    }
               case 4:
                    System.out.println("Name           e-mail ");
                    for (int i = 0; i<list.size(); i++){
                         System.out.println( list.get(i).name + list.get(i).e_mail);
                    }
            
          }
          System.out.println("Press any key to return to Menu");
          input = s.next();         
        } while (choice != 5);
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("Input.txt")));
        for (int i = 0; i<list.size(); i++){
            out.println(list.get(i).Name + " " + list.get(i).e_mail);
        }        
        out.close();
     }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote