Questions
I want to write this program in java. Write a simple airline ticket reservation program in...

I want to write this program in java.

Write a simple airline ticket reservation program in java.The program should display a menu with the following options: reserve a ticket, cancel a reservation, check whether a ticket is reserved for a particular person, and display the passengers. The information is maintained on an alphabetized linked list of names. In a simpler version of the program, assume that tickets are reserved for only one flight. In a fuller version, place no limit on the number of flights. Create a linked list of flights with each node including a pointer to a linked list of passengers.

In: Computer Science

please answer as text You are given a Node class and a List class: public class...

please answer as text

You are given a Node class and a List class:

public class Node {

       int           data;

       Node       next;

       Node(int d, Node n){

            data = d;

            next = n;

      }

}

public class List{

       Node header;

}

Write a java method insertNodeBefore( ) which takes two integers: int ref which is the data of the node that we need to insert a new node before, and int d which is the data of the new node we want to insert, for the Linked list mylist.

In: Computer Science

JAVA Write a method that removes the duplicate elements from an array list of integers using...

JAVA

Write a method that removes the duplicate elements from an array list of integers using the following header:

public static void removeDuplicate(ArrayList list)

Write a test program that prompts the user to enter 10 integers to a list and displays the distinct integers separated by exactly one space.

Here is a sample run:

Enter ten integers: 10 20 30 20 20 30 50 60 100 9

The distinct integers are: [10, 20, 30, 50, 60, 100, 9]

In: Computer Science

Problem 2 Write a function (call it by your first name e.g. abc_trim) that takes a...

Problem 2

Write a function (call it by your first name e.g. abc_trim) that takes a list as argument , modifies it by removing the first and last two elements, and returns the new modified list e.g. if we call the function as katline_trim([1,4,6,8,11, 15]), we should get [4,6,8]. (Hint: Look at how we refer to list elements by their index and also how we use a negative number as index. You can also use a loop with the len() method

NB: Include python code, please. use spider

In: Computer Science

Use the following information to create SQL commands to retrieve data from Henry Books database :...

Use the following information to create SQL commands to retrieve data from Henry Books database :

For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name.
For each book published by Plume, list the book code, book title, and price.
List the book title, book code, and price of each book published by Plume that has a book price of at least $14.
List the book code, book title, and units on hand for each book in branch number 4.
List the book title for each book that has the type PSY and that is published by Jove Publications.
Find the book code and book title for each book located in branch number 2 and written by author 20.
Find the book title, author last name, and units on hand for each book in branch number 4.
Repeat Exercise 7, but this time list only paperback books.
Find the book code and book title for each book whose price is more than $10 or that was published in Boston.
Find the book code and book title for each book whose price is more than $10 and that was published in Boston.
Find the book code and book title for each book whose price is more than $10 but that was not published in Boston.

In: Computer Science

We have created an ArrayList of Person class. write a method called push that pushes all...

We have created an ArrayList of Person class. write a method called push that pushes all the people with the even length last name to the end of the ArrayList

Content of the ArrayList before push

[alex Bus, Mary Phillips, Nik Lambard, Rose Rodd, Esa khan, Jose Martinex, Nik Patte]

content of the ArrayList after the push method
[alex Bus, Nik Lambard, Nik Patte, Mary Phillips, Rose Rodd, Esa khan, Jose Martinex]

import java.util.*;
class Person
{
   private String name;
   private String last;
   public Person(String name, String last)
   {
     this.name = name;
     this.last = last;
   }
   public String getLast()
   {
     return last;
   }
   public String getFirst()
   {
     return name;
   }
   public String toString()
   {
     return name + " " + last;
   }
}

public class ArrayList
{
  public static void main(String[] args)
  {
    ArrayList<Person> list = new ArrayList<Person>();
     list.add(new Person ("alex","Bus"));
     list.add(new Person("Mary", "Phillips"));
     list.add(new Person("Nik", "Lambard") );
     list.add(new Person("Rose","Rodd"));
     list.add(new Person("Esa","khan"));
     list.add(new Person("Jose","Martinex"));
     list.add(new Person("Nik","Patte"));
     System.out.println(list);
     push(list);
     System.out.println(list);

  
  }
//this method pushes all the people with the even length last name to the end of the list
 public static void push(ArrayList<Person> list) {
         
 }
     
   
}

In: Computer Science

You are asked to write a simple C++ phonebook application program. Here are the requirements for...

You are asked to write a simple C++ phonebook application program. Here are the requirements for the application.

  • read the contact information from a given input file (phonebook.txt) into a dynamically created array of Contact objects. Each line of the input line includes name and phone information of a contact. Assume that each name has a single part
  • Allow to perform operations on array of data such as search for a person, create a new contact or delete an existing contact

A sample run:

***MY PHONEBOOK APPLICATION***

Please choose an operation:

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): A

Enter name: MARY SMITH

Enter phone: 5062396

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): S

Enter name: MARY SMITH

Phone Number: 5062396

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L

BARBARA BROWN 4059171

ELIZABETH JONES 2736877

LINDA WILLIAMS 3532665

PATRICIA JOHNSON 973437

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): D

Enter name: LINDA WILLIAMS

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L

BARBARA BROWN 4059171

ELIZABETH JONES 2736877

PATRICIA JOHNSON 973437

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): Q

In: Computer Science

Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and...

Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and a parameter of type int. The first parameter is the plaintext message, and the second parameter is the encryption key. The method strictly does the following tasks:

a. Convert the string into a list (let us refer to it as lista). An element in the generated list is the position of the corresponding letter in the parameter string in the English alphabet. Example: ‘C’ or ‘c’ in the parameter string will be converted to the number

b in lista. Assume that the parameter string contains only alphabetic characters. 2. Encrypt the generated list (lista) using Caesar cipher using the provided encryption key. You do not need to create a new list, update the elements of the lista list.

c. Convert lista into a string again by converting the positional element in the list to a character in the ciphertext string. Assume that the plaintext is ‘WelcomeToCryptography’ and the shift key is 5.

Step Output 1

lista = [22, 4, 11, 2, 14, 12, 4, 19, 14, 2, 17, 24, 15, 19, 14, 6, 17, 0, 15, 7, 24] 2

lista = [1, 9, 16, 7, 19, 17, 9, 24, 19, 7, 22, 3, 20, 24, 19, 11, 22, 5, 20, 12, 3] 3

ciphertext = ‘BJQHTRJYTHWDUYTLWFUMD’

The method’s header is as follows: def casesarencryption(s, key):

In: Computer Science

File density.txtPreview the document contains a list of the density in grams per cubic centimeter of...

File density.txtPreview the document contains a list of the density in grams per cubic centimeter of all the planets, plus Pluto. It looks like this: Mercury 5.43 Venus 5.25 Earth 5.52 Mars 3.83 Jupiter 1.33 Saturn 0.71 Uranus 1.24 Neptune 1.67 Pluto 2.05 Write a program named lastname_firstname_density.py that reads the numbers from the file into a list and then calculates and prints, properly labeled: The minimum density The maximum density The average density The median density (Hint: use split() to separate the planet name from the density.) You don’t need a list for the first three of these, but you do need a list to calculate the median. Finding the Median To find the median of a group of n numbers, sort them into order. (Hint: use Python’s sort method). If n is odd, the median is the middle entry. In a list named data this will be element data[(n ‑ 1) // 2]. Note the use of // to do integer division. If n is even, the median is the average of the numbers “surrounding” the middle. For a list named data, this is (data[(n // 2)] + data[(n // 2) ‑ 1]) / 2.0. Your program must work for a file with any number of entries. The file I am providing happens to have an odd number of entries, but if I gave you a similar file for the major moons of Saturn, it would have an even number of entries, and your program would still have to correctly calculate the statistics for that file.

In: Computer Science

{PYTHON }You have a CSV file containing the location and population of various cities around the...

{PYTHON }You have a CSV file containing the location and population of various cities around the world. For this question you'll be given a list of cities and return the total population across all those cities. Write a function named "total_population" that takes a string then a list as parameters where the string represents the name of a CSV file containing city data in the format "CountryCode,CityName,Region,Population,Latitude,Longitude" and the second parameter is a list where each element is itself a list containing 3 strings as elements representing the CountryCode, CityName, and Region in this order. Return the total population of all cities in the list. Note that the city must match the country, name, and region to ensure that the correct city is being read.

import pandas as pd #to read csv into a dataset
  
def total_population(file_name, city_list): #function definition with required parameters
data = pd.read_csv(file_name) #reading a csv file
pop = 0 #for storing population
for i in city_list: #looping through the list
temp = data.loc[(data.Country == int(i[0])) & (data.City == i[1]) & (data.Region == i[2])] #selecting row matching the conditions
pop += int(temp['Population']) #summing population for each city
return pop

error on input ['cities.csv', [['nl', 'vlissingen', '10'], ['ca', 'whitehorse', '12'], ['ph', 'camflora', 'H2'], ['gb', 'johnshaven', 'T6']]]: 'DataFrame' object has no attribute 'CountryCode'

also that return outside function

In: Computer Science