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.

New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter7: Designing A Web Form: Creating A Survey Form
Section: Chapter Questions
Problem 4CP2
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
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning