Question

Complete and correct answer is required to give full credit,thank you Consider the following set of...

Complete and correct answer is required to give full credit,thank you

Consider the following set of requirements for an airline database that is used to keep track of flights, passengers, employees etc. for an airline. You will be graded not only on the correctness and completeness of the design but also on its quality.

1)     It is important to keep track of each passenger's name, address, phone number and meal preference (values could be vegetarian, sea-food, italian, anything). At times, it becomes necessary to refer to the city, state, and zip of the passenger's address.

2)     Each flight is described by its number, dep_city, arr_city, dep_time and arr_time. For this assignment, we will assume that all entries in the database are direct flights only. The flights are uniquely identified by their number.

3)     Obviously, it is important to keep track of all airline personnel. For each person, we need to keep track of the unique employee number, name, address and salary.

4)     The airline keeps track of all departures for one year. For each departure, we need to have the date of departure, the flight that it represents, all personnel who are going to be assigned to it, and all passengers that are booked on it.

5)     For each type of plane in the whole world, the airline wants to keep track of its model number and manufacturer. For example, the manufacturer of a plane whose model number is 747 is Boeing Corporation.

6)     Each aircraft owned and operated by the airline is assigned a unique serial number, and the airline keeps track of what type of plane it is. For example, serial # of a specific plane may be A1234 and type may be 747. Each departure is assigned a specific aircraft owned by the company.

7)     There is a select group of personnel called pilots for whom the information about which types of planes can they fly along with the date when they received their pilot licenses is kept.

Design an ER schema for this application, and draw an ER diagram for that schema. Specify key attributes of each entity type and structural constraints on each relationship type. Specify the structural constraints using partial/total participation and specification of cardinality ratio. If you find that the specifications are incomplete, then make appropriate assumptions and document them precisely. Do a complete job.

Homework Answers

Answer #1

import java.io.*;

import java.util.*;

public class Airline {

    /**

     * The number of seats on the plane

     */

    static final int MAX_SEATS = 8;

public Airline() {

    }

    public void main(String[] args) {

        boolean done = false;

        String[] seats = new String[MAX_SEATS];     // the passenger list

        initializeSeats(seats);

        do {

            printMainMenu();

            int choice = getMainMenuChoice();       // choice off of the main menu

            switch (choice) {

            case 1:

                makeReservation(seats);

                break;

            case 2:

                cancelReservation(seats);

                break;

            case 3:

                printSeatingChart(seats);

                break;

            case 4:

                done = true;

                break;

            }

        } while (!done);

    }

//CONSOLE

public class Console {

    private BufferedReader in;

    private String integerReprompt = "Invalid integer. Try again: ";

    private String doubleReprompt = "Invalid double. Try again: ";

    private String charReprompt = "Invalid character. Try again: ";

     {

        in = new BufferedReader(new InputStreamReader(System.in));

    }

    public String readString() {

        String s = null;

            s = in.readLine();

        return s;

    }

    public char readChar() {

        char c = 0;

            String s = in.readLine();

                if (s.length() == 1) {

                    c = s.charAt(0);

                    valid = true;

                } else {

                    System.out.print(charReprompt);

                }

        return c;

    }

    int readInt() {

        int i = 0;

            boolean valid = false;

                    i = Integer.parseInt(in.readLine());

                    valid = true;

                    System.out.print(integerReprompt);

        return i;

    }

    public double readDouble() {

        double d = 0.0;

        boolean valid = true;

                    d = Double.parseDouble(in.readLine());

                    valid = true;

                    valid = false;

                    System.out.print(doubleReprompt);

        return d;

    }

    public void pause() {

            System.out.print("Press enter to continue...");

            in.readLine();

        }

    public void setIntegerReprompt(String prompt) {

        integerReprompt = prompt;

    }

    public void setDoubleReprompt(String prompt) {

        doubleReprompt = prompt;

    }

    public void setCharReprompt(String prompt) {

        charReprompt = prompt;

    }

}

//END CONSOLE

    /**

     * Print the main menu

     */

    void printMainMenu() {

        System.out.println("\nMain Menu\n");

        System.out.println("1. Make a reservation");

        System.out.println("2. Cancel a reservation");

        System.out.println("3. Print seating chart");

        System.out.println("4. Quit");

        System.out.println();

    }

    /**

     * Get the user's choice off the main menu

     */

    int getMainMenuChoice() {

        int choice;             // choice entered

        boolean valid = false; // is choice valid?

        do {

            System.out.print("===> ");

            choice = Console.readInt();

            if (1 <= choice && choice <= 4) {

                valid = true;

            } else {

                System.out.println("Invalid choice.");

            }

        } while (!valid);

        return choice;

    }

    /**

     * Initialize each element of seats to the empty string

     */

    void initializeSeats(String[] seats) {

        for (int i = 0; i < seats.length; i++) {

            seats[i] = "";

        }

    }

    /**

     * Make a reservation

     */

    void makeReservation(String[] seats) {

        int seatIndex = findEmptySeat(seats);   // index of first empty seat

        if (seatIndex == seats.length) {

            System.out.println("All seats are full. Sorry.");

        } else {

            String name = getPassengerName();   // passenger's name

            seats[seatIndex] = name;

            System.out.println(name + " has been assigned seat #" + (seatIndex+1));

        }

    }

    /**

     * Cancel a reservation

     */

    void cancelReservation(String[] seats) {

        int seatIndex = getSeatToCancel();      // index of seat to cancel reservation for

        if (isEmpty(seats, seatIndex)) {

            System.out.println("Seat #" + (seatIndex+1) + " has not been reserved for anyone");

        } else {

            seats[seatIndex] = "";

            System.out.println("Seat #" + (seatIndex+1) + " is now available");

        }

    }

    /**

     * Print the seating chart

     */

    void printSeatingChart(String[] seats) {

        System.out.println("\nSeating Chart\n");

        for (int i = 0; i < seats.length; i++) {

            System.out.println((i+1) + ". " + seats[i]);

        }

    }

    /**

     * Find the index of the first empty seat on the plane.

     * If there are no empty seats, return seats.length

     */

    int findEmptySeat(String[] seats) {

        for (int i = 0; i < seats.length; i++) {

            if (isEmpty(seats, i)) {

                return i;

            }

        }

        return seats.length;

    }

    /**

     * Yield whether seats[seatIndex] is an empty seat.

     */

    boolean isEmpty(String[] seats, int seatIndex) {

        return seats[seatIndex].equals("");

    }

    /**

     * Input a passenger's name

     */

    String getPassengerName() {

        System.out.print("Enter the passenger's name: ");

        return Console.readString();

    }

    /**

     * Input the number of a seat to cancel, return the

     * index of that seat.

     */

    int getSeatToCancel() {

        boolean valid = false; // is the seat number valid?

        int seat;               // seat number to cancel

        do {

            System.out.print("Enter the seat to cancel: ");

            seat = Console.readInt();

            if (1 <= seat && seat <= MAX_SEATS) {

                valid = true;

            } else {

                System.out.println("Invalid seat number");

            }

        } while (!valid);

        return seat-1;

    }

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the following set of requirements for a UNIVERSITY database that is used to keep track...
Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students’ transcripts. This is similar but not identical to the database shown in Figure 1.2: a. The university keeps track of each student’s name, student number, Social Security number, current address and phone number, permanent address and phone number, birth date, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications...
Consider the following set of requirement for a BANK database. Then draw an ER diagram based...
Consider the following set of requirement for a BANK database. Then draw an ER diagram based the requirement. The database keeps track of each back’s name, routing number, address. Banks has bank branch (you could name the relationship as BRANCHES). The bank branch described as branch name, branch location and branch ID. The branch ID is unique for each bank, but not unique in general. Users open account in bank branches. The accounts described by account number, account type, account...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...