Based on the below code do the following tasks: EntryScreen should be adjusted so that the when the option ‘B’ is selected from the main menu, the screen is updated to show a bus management menu. If the option to add a bus is selected, the screen should display options for the type of menu to be shown. The entry screens should allow the subclasses of class bus to be populated.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Based on the below code do the following tasks:
EntryScreen
should be adjusted so that the when the option ‘B’ is selected from the main menu, the screen is
updated to show a bus management menu. If the option to add a bus is selected, the screen should
display options for the type of menu to be shown. The entry screens should allow the subclasses of
class bus to be populated. Figure 3 provides an example of the expected display. look at image uploaded

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class EntryScreen {

    public EntryScreen() {}

    public ArrayList<Planner> managePlanners(Scanner scan,ArrayList<Planner> plans, Ministry mny, ArrayList<Bus> buses) throws NumberFormatException
    {
        ReportScreen r = new ReportScreen();
        char mchoice = 'c';
        String menu="";
        while (mchoice!='X')
        {
            String menuOptions = "[A]dd/Create planner\n[E]dit/Update planner\n";
            menuOptions+="[L]ist/Read planner\n[D]elete planner\nE[x]it\n";
            System.out.println(menuOptions);
            menu = scan.next().toUpperCase();
            mchoice = menu.charAt(0);
            switch(mchoice)
            {

               
            case 'A':{
                Planner p = createPlanner(scan, mny, buses);
                if (p!=null)
                    plans.add(p);
                break;
               
            }
            case 'L':{
                Collections.sort(plans);
                r.listPlanners(plans, System.out);
                break;
            }
            case 'E':{
                System.out.println("Please enter the ID of the planner to be updated:");
                int pid = Integer.parseInt(scan.next());
                int pdx = findPlanner(plans,pid);
                if (pdx>=0)
                    plans.get(pdx).updateLocalData(scan);
                else
                    System.out.println("Planner with id "+pid+ " not found.");
                break;
            }
            case 'D':{
                System.out.println("Please enter the ID of the planner to be deleted:");
                int pid = Integer.parseInt(scan.next());
                int pdx = findPlanner(plans,pid);

                if (pdx>=0)
                    plans.remove(pdx);
                else
                    System.out.println("Planner with id "+pid+ " not found.");
                break;
            }


            }

        }
        return plans;
    }



    public Planner createPlanner( Scanner scan, Ministry mny, ArrayList<Bus> buses)
    {
        Planner p = null;
        try
        {
        System.out.println("Please enter Planner Name:");
        String name = scan.next();
        System.out.println("Please enter Planner Budget:");
        int budget = Integer.parseInt(scan.next());
        p = new Planner(name, budget, mny, buses);
        }
        catch(NumberFormatException nfe)
        {}
        return p;
    }

     
   


    public int findPlanner(ArrayList<Planner> plans, int pid)
    {
        int pdx =-1;
        int currdx=0;
        while ((currdx<plans.size())&&(pdx==-1))
        {
            if (plans.get(currdx).getId()==pid)
                pdx = currdx;
            currdx++;

        }

        return pdx;

    }





    public int findBus(ArrayList<Bus> buses, int bid)
    {
        int bdx=-1;
        ////code needed here to find bus with id bid in arraylist of buses





        return bdx;

    }



}


#
cols
4
456
5
6
7
Bus
Type
Generic
name Size
Price Level
Training name size Price level
name size price
Level
Level
Colo Col1 Col2 Col3
Sport
Party
Name size price
Tablo 1
Col4
Teacher Area
Spectator Area
Spectator Area
61
Col5
Col6
#Security
#Security Bar Area
Transcribed Image Text:# cols 4 456 5 6 7 Bus Type Generic name Size Price Level Training name size Price level name size price Level Level Colo Col1 Col2 Col3 Sport Party Name size price Tablo 1 Col4 Teacher Area Spectator Area Spectator Area 61 Col5 Col6 #Security #Security Bar Area
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education