Delete Details of Student Precondition User should know the student id of the

Delete details of student precondition user should

This preview shows page 5 - 11 out of 38 pages.

Delete Details of Student Precondition User should know the student id of the student which he want to delete Student ID should be correct Post condition Student record is removed from systemand parking Space id is released Actors User Triggering event User should choose delete option from the 5 | P a g e
Image of page 5
menu Description User wants to delete the details of the student User enter student ID IF id is correct message “Do you want to remove record of student with id student idY/N” IF y delete student IF n no delete Alternatives Student id is invalid: message ”sorry invalid student id” Use case Name View Report Goal View the details of total students in system Precondition None Post condition Details of all student in system is DISPLAY ed Actors User Triggering event User should choose view option from the menu Description User wants to view the record of students Alternatives None 6 | P a g e
Image of page 6
2.3 PSEUDOCODE Class MainlClass package CarPark import java.util.Scanner import java.util.ArrayList public class MainlClass static Scanner sc static ArrayList<Student> sList // holds student details static ArrayList<User> uList // holds user details static ArrayList<ParkingSpace> pList public static void main(String... args) sc = new Scanner(System.in) sList = new ArrayList<>() uList = new ArrayList<>() pList = new ArrayList<>() METHOD setParkingSpace() int loop = 0 int option while (loop == 0) DISPLAY ("Admin Panel.") DISPLAY ("1. Register.") DISPLAY ("2. Login") DISPLAY ("Enter your choice: ") option = sc.nextInt() switch (option) case 1: register() break case 2: login() break METHOD login() String id String password DISPLAY ("Enter UserID: ") id = sc.next() DISPLAY ("Enter Password") password = sc.next() 7 | P a g e
Image of page 7
FOR (User user : uList) if (user.getID().equals(id) && user.getPassword().equals(password)) DISPLAY ("Successfully logged in.") loggedIn() RETURN DISPLAY ("Invalid Id or Password") METHOD loggedIn() int choice while (true) DISPLAY ("1. Add Record") DISPLAY ("2. Update Record") DISPLAY ("3. Delete Record") DISPLAY ("4. View Record") DISPLAY ("5. Exit") DISPLAY ("Enter choice: ") choice = sc.nextInt() Case base on choice case =1 addRecord() case =2 updateRecord() case =3 deleteRecord() case =4: viewRecord() break case =5: System.exit(0) default: METHOD viewRecord() DISPLAY ("ID\tFirstName\tLastName\tContact\tEmail\tCarNumber\tRDate\t ParkingSpaceID") FOR Student s : sList DISPLAY (s.toString()) End For METHOD deleteRecord() DISPLAY ("Enter ID:") 8 | P a g e
Image of page 8
String id = sc.next() FOR (Student s : sList) if input Student ID is Equal to Student ID in the Arraylist of Student Then removeParkingSpace(s.getParkingSpace()) Remove Student form the Arraylist DISPLAY ("Record Deleted Successfully") RETURN End If End For DISPLAY ("Invalid ID") METHOD removeParkingSpace(ParkingSpace parkingSpace) FOR (ParkingSpace mParkingSpace : pList) If mParkingSpace.equals(parkingSpace)) parkingSpace.setStatus(true) RETURN End IF End For METHOD updateRecord() Student oldStudentRecord = null DISPLAY ("Enter ID:") String id = sc.next() FOR (Student s : sList) if (s.getID().equals(id)) oldStudentRecord = s break if (oldStudentRecord == null) DISPLAY ("Invalid ID") RETURN int option 9 | P a g e
Image of page 9
while (true)
Image of page 10
Image of page 11

You've reached the end of your free preview.

Want to read all 38 pages?

  • Fall '18
  • Login, Parking lot, return bay

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture