Given a partial main.py and PlaneQueue class in PlaneQueue.py, write the push() and pop() instance methods for PlaneQueue. Then complete main.py to read in whether flights are arriving or have landed at an airport.

An "arriving" flight is pushed onto the queue.
A "landed" flight is popped from the front of the queue.
Output the queue after each plane is pushed or popped. Entering -1 exits the program.

Click the orange triangle next to "Current file:" at the top of the editing window to view or edit the other files.

Note: Do not edit any existing code in the files. Type your code in the TODO sections of the files only. Modifying any existing code may result in failing the auto-graded tests.

Important Coding Guidelines:

Use comments, and whitespaces around operators and assignments.
Use line breaks and indent your code.
Use naming conventions for variables, functions, methods, and more. This makes it easier to understand the code.
Write simple code and do not over complicate the logic. Code exhibits simplicity when it’s well organized, logically minimal, and easily readable.
Ex: If the input is:

arriving AA213
arriving DAL23
arriving UA628
landed
-1
the output is:

Air-traffic control queue
Next to land: AA213

Air-traffic control queue
Next to land: AA213
Arriving flights:
DAL23

Air-traffic control queue
Next to land: AA213
Arriving flights:
DAL23
UA628

AA213 has landed.
Air-traffic control queue
Next to land: DAL23
Arriving flights:
UA628
CODE:
from PlaneQueue import PlaneQueue
from PlaneNode import PlaneNode

if __name__ == "__main__":
plane_queue = PlaneQueue()

Answers

Answer 1

class PlaneQueue:

   def __init__(self):

       self.head = None

       self.tail = None

   def push(self, plane_node):

       """Pushes a plane node onto the queue.

       Args:

           plane_node: The plane node to push.

       Returns:

           None.

       """

       # If the queue is empty, set the new node as the head and tail.

       if self.head is None:

           self.head = plane_node

           self.tail = plane_node

           return

       # Set the new node as the tail and the previous tail's next node.

       self.tail.next = plane_node

       self.tail = plane_node

   def pop(self):

       """Pops a plane node from the front of the queue.

       Returns:

           The plane node that was popped.

       """

       # If the queue is empty, return None.

       if self.head is None:

           return None

       # Get the plane node at the front of the queue.

       plane_node = self.head

       # Set the head to the next node.

       self.head = self.head.next

       # If the head is now None, set the tail to None as well.

       if self.head is None:

           self.tail = None

       return plane_node


Related Questions

Help ASAP
Title slide: Give as a minimum, the name of the layer you are presenting.
The layer data unit: Give the name of the layer'ss data unit and include information about the header and footer( if there is one). Diagram:Include a diagram (usingnsquares. circles arrows, etc.) showing the data unit and what its headers and footers do. Emancipation/decapsulation: Show where in the process the layer sits. List the layers that are encapsulated before your layer. List the layers that are decapsulated before your layer. Security: list one or two security risks at your layer and how to guard them. ​

Answers

The given project based on the question requirements are given below:

Layer: Transport Layer

Data Unit: Segment

Header: Contains source and destination port numbers, sequence and acknowledgment numbers, and control flags

Footer: Checksum to ensure integrity

Encapsulation: Sits between the Network and Session Layers.

Encapsulated layers: Application, Presentation, and Session Layers

Decapsulated layers: Network Layer

Security:

Risk: TCP SYN Flood Attacks, where the attacker sends multiple SYN packets to overwhelm the server and cause a denial of service.

Guard: Implementing SYN cookies or limiting the number of SYN packets per second to prevent flooding. Also, using encrypted connections to protect data confidentiality.

Read more about presentation slide here:

https://brainly.com/question/24653274

#SPJ1

Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.

Ex: If the input is:

5 2 4 6 8 10
the output is:

10 8 6 4 2
To achieve the above, first read the integers into an array. Then output the array in reverse.
CODE:
import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int[] userList = new int[20]; // List of numElement integers specified by the user
int numElements; // Number of integers in user's list
// Add more variables as needed

numElements = scnr.nextInt(); // Input begins with number of integers that follow

/* Type your code here. */
}

Answers

Answer:
Here is the program that reads a list of integers, and outputs those integers in reverse.

import java.util.Scanner;

public class LabProgram {

 public static void main(String[] args) {

   Scanner scnr = new Scanner(System.in);

   int[] userList = new int[20]; // List of numElement integers specified by the user

   int numElements; // Number of integers in user's list

   numElements = scnr.nextInt(); // Input begins with number of integers that follow

   // Read integers into array

   for (int i = 0; i < numElements; i++) {

     userList[i] = scnr.nextInt();

   }

   // Output integers in reverse

   for (int i = numElements - 1; i >= 0; i--) {

     System.out.print(userList[i] + " ");

   }

 }

}

Explanation:

This Java program takes input from the user via the console, and then reverses the order of the integers entered by the user and prints them out in the console.

Here is a more detailed explanation of how this code works:

The program first imports the Scanner class from the java.util package, which allows the program to read user input from the console.It then defines a public class called "LabProgram" with a main method that takes an array of Strings as an argument.In the main method, a new Scanner object named "scnr" is created to read user input from the console.The program creates an integer array called "userList" with a length of 20. This will be used to store the list of integers entered by the user.The program creates an integer variable called "numElements" to store the number of integers that the user will enter.The program reads in the first integer entered by the user using the "nextInt()" method of the Scanner object, and assigns it to "numElements".The program then enters a loop that reads in the rest of the integers entered by the user, and stores them in the "userList" array. The loop runs "numElements" times, and at each iteration, the program reads in an integer using the "nextInt()" method of the Scanner object and assigns it to the corresponding element of the "userList" array.Once all the integers have been read in and stored in the "userList" array, the program enters another loop that starts from the last element of the array and prints out each integer in reverse order, separated by a space. The loop runs from "numElements-1" to 0, and at each iteration, it prints out the integer stored in the corresponding element of the "userList" array using the "print()" method of the System.out object.Once all the integers have been printed out in reverse order, the program terminates.

Given main.py and a Node class in Node.py, complete the LinkedList class (a linked list of nodes) in LinkedList.py by writing the insert_in_ascending_order() method that inserts a new Node into the LinkedList in ascending order.

Click the orange triangle next to "Current file:" at the top of the editing window to view or edit the other files.

Note: Do not edit any existing code in the files. Type your code in the TODO sections of the files only. Modifying any existing code may result in failing the auto-graded tests.

Important Coding Guidelines:

Use comments, and whitespaces around operators and assignments.
Use line breaks and indent your code.
Use naming conventions for variables, functions, methods, and more. This makes it easier to understand the code.
Write simple code and do not over complicate the logic. Code exhibits simplicity when it’s well organized, logically minimal, and easily readable.
Ex: If the input is:

8 3 6 2 5 9 4 1 7
the output is:

1 2 3 4 5 6 7 8 9
CODE: from Node import Node
from LinkedList import LinkedList

if __name__ == "__main__":
int_list = LinkedList()

user_input = input()

# Convert the string tokens into integers and insert into intList
tokens = user_input.split()
for token in tokens:
num = int(token)
new_node = Node(num)
int_list.insert_in_ascending_order(new_node)

int_list.print_list()

Answers

Answer:

class LinkedList:

   def __init__(self):

       self.head = None

   def insert_in_ascending_order(self, new_node):

       """Inserts a new node into the linked list in ascending order.

       Args:

           new_node: The node to insert.

       Returns:

           None.

       """

       # If the linked list is empty, set the new node as the head.

       if self.head is None:

           self.head = new_node

           return

       # Find the insertion point.

       current = self.head

       while current.next is not None and current.next.data < new_node.data:

           current = current.next

       # Insert the new node.

       new_node.next = current.next

       current.next = new_node

   def print_list(self):

       """Prints the linked list in order.

       Returns:

           None.

       """

       current = self.head

       while current is not None:

           print(current.data)

           current = current.next

What resistance R3 in parallel with resistances R1=10K Ω and R2=20K Ω gives an
equivalent resistance of Req=50 Ω

Answers

Answer:

Explanation:

R1 and R2 are in  series  =R1+R2=10K+20K=30KΩ

Req=50Ω

R3 is parallel with R1 and R2=>

(1/30k)+(1/r)=(1/Req)

r=50.0834Ω

A browser can be better secured by using which of the following practices?

Deactivating background scripts
Installing Microsoft Word
Allowing all pop-ups
Using the same password for all accounts

Answers

Answer:

A. Deactivating background scripts

A browser can be better secured by deactivating background scripts, which can reduce the risk of malicious code running without the user's knowledge. Installing Microsoft Word does not relate to browser security. Allowing all pop-ups can increase the risk of malware and phishing attacks. Using the same password for all accounts makes them vulnerable to hacking if one account is compromised. Strong, unique passwords and two-factor authentication can enhance browser security. Additionally, keeping the browser and plugins up-to-date and avoiding suspicious websites can minimize the risk of security breaches.

Zeke is working on a project for his economics class. He needs to create a visual that compares the prices of coffee at several local coffee shops. Which of the charts below would be most appropriate for this task?

Line graph
Column chart
Pie chart
Scatter chart

Answers

Opting for a column chart is the best way to compare prices of coffee at various local coffee shops.

Why is a column chart the best option?

By representing data in vertical columns, this type of chart corresponds with each column's height showing the value depicted; facilitating an efficient comparison between different categories.

In our case, diverse branches of local coffee shops serve as various categories and their coffee prices serve as values. Depicting trends over time suggested usage of a line graph. Pie charts exhibit percentages or proportions ideally whereas scatter charts demonstrate the relationship between two variables.

Read more about column chart here:

https://brainly.com/question/29904972

#SPJ1

explain the structure of c program with example

Answers

Answer:

A C program typically consists of a number of components, including preprocessor directives, function prototypes, global variables, functions, and a main function.

Explanation:

Here's an explanation of each component, followed by an example C program that demonstrates their usage:

Preprocessor Directives: Preprocessor directives are instructions to the C preprocessor, which processes the source code before compilation. They usually start with a '#' symbol. Some common directives are #include for including header files and #define for defining constants.

Function Prototypes: Function prototypes provide a declaration of functions that will be used in the program. They specify the function's name, return type, and the types of its parameters.

Global Variables: Global variables are variables that can be accessed by any function in the program. They are usually defined outside of any function.

Functions: Functions are blocks of code that can be called by name to perform specific tasks. They can accept input parameters and return a value. Functions are generally declared before the main function.

Main Function: The main function is the entry point of the program. It's where the execution starts and ends. It has a return type of int and typically takes command-line arguments via two parameters: argc (argument count) and argv (argument vector).

Here's an example C program that demonstrates the structure:

// Preprocessor directives

#include <stdio.h>

// Function prototypes

void print_hello_world(void);

// Global variable

int global_var = 10;

// Functions

void print_hello_world(void) {

   printf("Hello, World!\n");

}

// Main function

int main(int argc, char *argv[]) {

   // Local variable

   int local_var = 20;

   printf("Global variable value: %d\n", global_var);

   printf("Local variable value: %d\n", local_var);

   print_hello_world();

   return 0;

}

This simple C program demonstrates the use of preprocessor directives, a function prototype, a global variable, a function, and the main function. When run, it prints the values of a global and a local variable, followed by "Hello, World!".

Other Questions
Both the national grange and the farmers alliances worked to:. -AST and ALT high, no other risk factors except for fat and HTN with thiazide. Why high AST and ALT? Ethan is considering the replacement of the existing network for his organization. He has projected organizational growth at 50% per year for the next five years. With this growth, many new employees will surely be hired and trained. He has received a large amount of money from a small business grant for the initial development. The architecture Ethan should select is _____.a. server-basedb. client-based c. client-serverd. network-basede. client-network server Why did president jackson veto the bill to renew the charter of the bank?. An Excel function that controls how many decimal places display for a value is called: a balloon is filled with helium gas. the balloon is put into a chamber whose pressure is less than the atmospheric pressure and at atmospheric temperature. which balloon shows the final result? which of the following is not a key component of a service blueprint? line of transference line of interaction line of visibility front-stage actions by customer contact personnel What is the term used to describe the practice of giving government jobs to political bakers? when a patient in shock is receiving fluid replacement, what should the nurse monitor frequently? (select all that apply.) PD 2: how and why the different goals and interests of European leaders and colonists affected how they viewed themselves and their relationship with Britain Most state vehicle codes state that you shall not drive a motor vehicle after taking a substance which alters the central nervous system. This includes over the counter, prescription, and of course, illegal drugs.T/F The quantity demanded of a good or service is the amount that A, firms are willing to sell during a given time period at a given price. B. is actually bought during a given time period at a given price. C, a consumer would like to buy but might not be able to afford D. consumers plan to buy during a given time period at a given price. A deposit made by a company will appear on the bank statement as a. Using standard heats of formation, calculate the standard enthalpy change for the following reaction: DfH of HCl(g) is -92.31Kj/molH2(g)+Cl2(g)-->2HCl(g) sara takes her four-year-old brother matt to a carnival for the first time. they decide to ride the merry-go-round. matt runs to the front of the line. his sister pulls him back and explains they have to stand in line. this is an example of socialization. T/F? Question 173What acts as a firewall that controls the traffic allowed to reach one or more instances? A. Security groupB. ACLC. IAMD. IAM which one of the following types of electromagnetic wave travels through space the fastest? which one of the following types of electromagnetic wave travels through space the fastest? microwaves infrared ultraviolet radio waves they all travel through space at the same speed. Write one paragraph comparing chapter five of the book "Frankenstein" with the short film. A paragraph is 5-7 complete sentences. describe at least two ways they were similar, with evidencedescribe at least two ways they were different, with evidence Which of the following represents the symmetric property of congruence?A) If AB = CD, then AB EFC) If AB CD , then CD ABD) AB AB How many times has final jeopardy had only one contestant.