Questions
Modify the classes so that it accepts integers instead of characters. (If you understand the concept...

Modify the classes so that it accepts integers instead of characters. (If you understand the concept of generic classes, convert the Node and Linked List classes to a generic so that they can be instantiated with either integers or characters)

JAVA Code

class aNode {

char data;
aNode next;

aNode(char mydata) { // Constructor
data = mydata;
next = null;
}
};
//-----------------------------------------------------

class linkedList {

aNode head; // Head of the linked list
int size;

linkedList() { // Constructor
head = null;
size = 0;
}
//-----------------------------------------------------

public void insert_at_beginning(char value) {
aNode newNode = new aNode(value); // create aNew node
newNode.next = head;
head = newNode;
size++;
}
//-----------------------------------------------------

public void insert_at_end(char value) {
aNode newNode = new aNode(value); // create aNew node
if (isEmpty()) {
newNode.next = head;
head = newNode;
size++;
} else {
//find the last node
aNode ptr;
ptr = head;
while (ptr.next != null) {
ptr = ptr.next;
}
ptr.next = newNode; //add the node to the end
size++;
}
}
//-----------------------------------------------------

public void insert_after(char value, char searchValue) {
if (isEmpty()) {
System.out.println("Linked List is empty, no way to insert " + value + " after " + searchValue);
} else {
//find the node with searchValue
aNode ptr;
boolean found = false;
ptr = head;
while (ptr != null && found == false) {
if (ptr.data == searchValue) {
found = true;
} else {
ptr = ptr.next;
}
}
if (ptr == null) {
System.out.println("Did not find " + searchValue + "Nothing Inserted");
} else {
aNode newNode = new aNode(value); // create aNew node
newNode.next = ptr.next;
ptr.next = newNode; //add the node after the searchValue
size++;
}
}
}
//-----------------------------------------------------
// Delete the first node with the value

public void delete(char deleteValue) {
if (isEmpty()) {
System.out.println("Linked List is empty, nothing to delete");
} else {
aNode deletePtr = head; // create a reference to head
if (head.data == deleteValue) {
head = head.next; // remove the head
deletePtr = null; // make the node available for garbage collection.
size--;
} else {
aNode prevPtr;
deletePtr = prevPtr = head;
boolean found = false;
//find the value to be deleted
while (deletePtr != null && found == false) {
if (deletePtr.data == deleteValue) { // Read about the difference between == and .equals()
found = true;
prevPtr.next = deletePtr.next;
deletePtr = null; // make deletePtr available to garbage collection
size--;
} else {
prevPtr = deletePtr;
deletePtr = deletePtr.next;
}
}
if (found == false) {
System.out.println("Not able to find/delete " + deleteValue + " in the Linked List");
}
}
}
}
//-----------------------------------------------------

public boolean isEmpty() {
if (head == null) {
return (true);
} else {
return (false);
}
}
//-----------------------------------------------------

public void print() {
aNode ptr;
ptr = head;
System.out.print("Head--> ");
while (ptr != null) {
System.out.print(ptr.data + " --> ");
ptr = ptr.next;
}
System.out.println("NULL");
}
//-----------------------------------------------------

public int getSize() {
return (size);
}
//-----------------------------------------------------

public void freeAll() {

aNode freePtr = head;
while (head != null) {
head = head.next;
// the next two lines are unnecessary, but are included for
// illustration of how memory is freed up
//
freePtr = null; // make the node available for garbage collector
freePtr = head; // now let the freePtr to the new head
}
head = null;
size = 0;

In: Computer Science

Note I did not post the city jail database because it was too long and it...

Note I did not post the city jail database because it was too long and it couldnt let me post, however, there was another question answered with the same database right here, so please use that. It is exactly the same. If not let me know how i can post the database subqueries)

Your files must be in sql script format so that they can be run in SQL Developer.

Using the City Jail database to answer the questions.

Use an sql sub-query statement to answer the following:

  1. List the name of each officer who has reported less than the maximum number of crimes officers have reported.
  2. List the names of all criminals who have committed more than average number of crimes and aren’t listed as violent offenders.
  3. List appeal information for each appeal that has a less than the average number of days between the filing and hearing dates.
  4. List the names of probation officers who have had a greater than average number of criminals assigned.
  5. List each crime that has had the least number of appeals recorded.

    HINT:

    The following memo was used to create an initial database design (E-R model) for the City Jail that indicates entities, attributes (columns), primary keys, and relationships.

    MEMO

    To: Database Consultant

    From: City Jail Information Director

    Subject: Establishing a Crime-Tracking Database System

    It was a pleasure meeting with you last week. I look forward to working with your company to create a much-needed crime-tracking system. As you requested, our project group has outlined the crime-tracking data needs we anticipate. Our goal is to simplify the process of tracking criminal activity and provide a more efficient mechanism for data analysis and reporting. Please review the data needs outlined below and contact me with any questions.

    Criminals: name, address, phone number, violent offender status (yes/no), probation status (yes/no), and aliases

    Crimes: classification (felony, misdemeanor, other), date charged, appeal status (closed, can appeal, in appeal), hearing date, appeal cutoff date (always 60 days after the hearing date), arresting officers (can be more than one officer), crime codes (such as burglary, forgery, assault; hundreds of codes exist), amount of fine, court fee, amount paid, payment due date, and charge status (pending, guilty, not guilty).

    Sentencing: start date, end date, number of violations (such as not reporting to probation officer), and type of sentence ( jail period, house arrest, probation).

    Appeals: appeal filing date, appeal hearing date, status (pending, approved, and disapproved).

    Note: Each crime case can be appealed up to three times.

    Police officers: name, precinct, badge number, phone contact, status (active/inactive)

    Additional notes: A single crime can involve multiple crime charges, such as burglary and assault. Criminals can be assigned multiple sentences. For example, a criminal might be required to serve a jail sentence followed by a period of probation. Answer each or the questions with an sql statement that contains at least one subquery.

    Hint: Use subqueries, and work “inside out” toward the result; that is, retrieve the

    employee number of N. Smith, search for the codes of all courses he ever taught, and so on.

In: Computer Science

I want this program written in JAVA with the algorithm(The step by step process for the...

I want this program written in JAVA with the algorithm(The step by step process for the problem) . Please help it is due in a couple of hours. I don't want the C++ program, I want it in JAVA please

#20 Theater Ticket Sales

Create a TicketManager class and a program that uses it to sell tickets for a single performance theater production.


Here are the specifications:
• The theater's auditorium has 15 rows, with 30 seats in each row. To represent the seats, the TicketManager class should have a two-dimensional array of SeatStructures. Each of these structures should have data members to keep track of the seat's price and whether or not it is available or already sold.
• The data for the program is to be read in from two files located in the Chapter 8 programs folder on this book's companion website. The first one, SeatPrices.dat, contains 15 values representing the price for each row. All seats in a given row are the same price, but different rows have different prices. The second file, SeatAvailability. dat, holds the seat availability information. It contains 450 characters (15 rows with 30 characters each), indicating which seats have been sold (' • ') and which are available ( '#' ). Initially all seats are available. However, once the program runs and the file is updated, some of the seats will have been sold. The obvious function to read in the data from these files and set up the array is the constructor that runs when the TicketManager object is first created.
• The client program should be a menu-driven program that provides the user with a menu of box office options, accepts and validates user inputs, and calls appropriate class functions to carry out desired tasks. The menu should have options to display the seating chart, request tickets, print a sales report, and exit the program.
• When the user selects the display seats menu option, a TicketManager function should be called that creates and returns a string holding a chart, similar to the one shown here. It should indicate which seats are already sold ( *) and which are still available for purchase (#) . The client program should then display the string.

Seats 1234567890 12345678901234567890

Row 1 ***###***###******############

Row 2 ####*************####*******##

Row 3 **###**********########****###

Row 4 **######**************##******

Row 5 ********#####*********########

Row 6 ##############************####

Row 7 #######************###########

Row 8 ************##****############

Row 9 #########*****############****

Row 10 #####*************############

Row 11 #**********#################**

Row 12 #############********########*

Row 13 ###***********########**######

Row 14 ##############################

Row 15 ##############################
• When the user selects the request tickets menu option , the program should prompt for the number of seats the patron wants, the desired row number, and the desired starting seat number. A TicketManager ticket request function should then be called and passed this information so that it can handle the ticket request. If any of the requested seats do not exist, or are not available, an appropriate message should be returned to be displayed by the client program. If the seats exist and are available, a string should be created and returned that lists the number of requested seats, the price per seat in the requested row, and the total price for the seats. Then the user program should ask if the patron wishes to purchase these seats.
• If the patron indicates they do want to buy the requested seats , a TicketManager purchase tickets module should be called to handle the actual sale. This module must be able to accept money, ensure that it is sufficient to continue with the sale, and if it is, mark the seat(s) as sold, and create and return a string that includes a ticket for each seat sold (with the correct row, seat number, and price on it).
• When the user selects the sales report menu option, a TicketManager report module should be called. This module must create and return a string holding a report that tells how many seats have been sold, how many are still available, and how much money has been collected so far for the sold seats. Think about how your team will either calculate or collect and store this information so that it will be available when it is needed for the report.
• When the day of ticket sales is over and the quit menu choice is selected, the program needs to be able to write the updated seat availability data back out to the file. The obvious place to do this is in the TicketManager destructor.

In: Computer Science

You are the lead trainer for the software development team at a large telecommunications company. You...

You are the lead trainer for the software development team at a large telecommunications company. You have been tasked with preparing a training document that explains the principles of polymorphism, inheritance, and encapsulation. Research these principles and provide examples for each principle, showing how they would be used in software development. Be sure to answer the question of how each principle would be employed in the software development process. Java programmers use class hierarchies for the purposes of inheritance. For example, given a Tree class, you could define Conifer and Deciduous subclasses that inherit from the parent Tree class, as follows: In your training document explanations regarding inheritance, depict inheritance by using a computer memory hierarchy in a class hierarchy diagram. Prepare a 6-8-page document that provides detailed explanations for polymorphism, inheritance, and encapsulation. Research computer memory hierarchy and the topic to use in your inheritance explanations at this link, making sure to cite it in APA style if you use specific information from the article. Develop a class hierarchy diagram for the memory hierarchy found at the URL. Include in your class hierarchy diagram at least three subclass levels. Each class and subclass must include at least one variable and one method.

Please answer to the questions in bold and don't copy from other posts.I need answers to the question only in bold.

In: Computer Science

In a N:M relationship which entity is the parent? Why?

In a N:M relationship which entity is the parent? Why?

In: Computer Science

Java 1. public void writeJSON(PrintStream ps) { Write the member variables in JSON format to the...

Java

1. public void writeJSON(PrintStream ps) {

Write the member variables in JSON format to the given PrintStream

}

2. public void writeJSON(PrintStream ps){

Write the member variables in JSON format to the given PrintStream.

}

In: Computer Science

Write a RECURSIVE method that receives 2 strings as parameters. The method will return true if...

Write a RECURSIVE method that receives 2 strings as parameters. The method will return true if the 2nd string is a subsequence of the 1st string. If not, the method will return false.

An empty string is a subsequence of every string. This is because all zero characters of the empty string will appear in the same relative order in any string

This method must not contain any loops.

In java

In: Computer Science

Mergesort is known to be one of the fastest algorithms for sorting lists of data. In...

Mergesort is known to be one of the fastest algorithms for sorting lists of data. In fact, the runtime of mergesort is proportional to n· logn where n is the size of the list to be sorted. Bubblesort, on the other hand is a much slower algorithm, since it's runtime is proportional to n2 , where n is the size of the list to be sorted.

As an experiment, mergesort is run on a slow computer, bubblesort is run on a fast computer and the times taken by each algorithm are recorded when sorting a list of size 10,000. We are surprised to find that the two runtimes are identical. In other words, the faster computer appears to have compensated for the slowness of bubblesort, relative to mergesort. To see whether this result remains true for bigger input sizes, we will redo the experiment, but use a list of size one hundred million, rather than ten thousand. After recording the new runtimes we will compute the ratio r = (new runtime of bubblesort) /  (new runtime of mergesort).

a) What should we predict the value of r to be? _________________

Your answer should be a whole number. For example, you would answer r = 1, if you think the algorithms still take the same amount of time. Or you would answer r = 2, if you think bubblesort takes twice as long a mergesort, and so on.

b) Justify your answer in Part a using runtime rules of thumb that we discussed in lecture.  (A detailed justification is needed here, involving some arithmetic.)

In: Computer Science

(Please use some in text citations and references or works cited please. If you have answered...

(Please use some in text citations and references or works cited please. If you have answered the question before please use a new answer thanks.

a. Search the web for various commercial encryption algorithms. b. Find one that you feel may be “snake oil”. c. Write a report explaining the encryption algorithm and your opinion *in-text citations and references are required *written in at least 2~3 paragraphs

In: Computer Science

Design and write a Corporate Code of Ethics for a professional computing/IT company. Your COE should...

Design and write a Corporate Code of Ethics for a professional computing/IT company. Your COE should be relative and detailed enough for your company of choice.

You will need to write up to (but not more than) three lines about your company of choice. Your company can be your future company that you will establish, or it can be an existing company. If it is an existing company it MUST NOT already have a published code of ethics/conduct on its website.

. Your answer should not be less than 1/3 of a page but should not exceed one full page.

In: Computer Science

JAVA Add static methods largest and smallest to the Measurable interface. The methods should return the...

JAVA

Add static methods largest and smallest to the Measurable interface. The methods should return the object with the largest or smallest measure from an array of Measurable objects.

In: Computer Science

6) c programming Case study: In a certain building at a top secret research lab, some...

6) c programming Case study: In a certain building at a top secret research lab, some yttrium-90 has leaked into the computer analysts’ coffee room. The leak would currently expose personnel to 150 millirems of radiation a day. The half-life of the substance is about three days, that is, the radiation level is only half of what is was three days ago. The analysts want to know how long it will be before the radiation is sown to a safe level of 0.466 millirem a day. They would like a chart that displays the radiation level for every there days with message unsafe or sage after every line. The chart should stop just before the radiation level is on-tenth of the sage level, because the more cautious analysts will require a safety factor of 10.

In: Computer Science

Using Octave, analyze the response for the system to a unit step input. Share the code...

Using Octave, analyze the response for the system to a unit step input. Share the code or commands used.

System : x'''+3x''+2x=0

In: Computer Science

Consider the following relation with structure PROJECT(ProjectID, EmployeeName, EmployeeSalary). ProjectID EmployeeName EmployeeSalary 100A Eric Jones 64,000...

Consider the following relation with structure PROJECT(ProjectID, EmployeeName, EmployeeSalary). ProjectID EmployeeName EmployeeSalary 100A Eric Jones 64,000 100A Donna Smith 70,000 100B Donna Smith 70,000 200A Eric Jones 64,000 200B Eric Jones 64,000 200C Eric Parks 58,000 200C Donna Smith 70,000 200D Eric Parks 58,000 Suppose that the following functional dependencies exist: (ProjectID, EmployeeName) → EmployeeSalary EmployeeName → EmployeeSalary Normalize this relation into BCNF. For this problem you only need to include table names, primary keys, and attributes as part of your solutions.

In: Computer Science

QUESTION 5 What is printed? int[] aArray = {1, 2, 3, 4}; int[] bArray = {5,...

QUESTION 5

  1. What is printed?

    int[] aArray = {1, 2, 3, 4};
    int[] bArray = {5, 6, 7, 8};
    bArray = aArray;
    System.out.print(bArray[2]);

1 points   

QUESTION 6

  1. What is printed?

    public static void main(String[] args)
     {
     int[] aArray = { 1, 2, 3, 4 };
     System.out.print(aArray[2]);
     int i = aMeth(aArray);
     System.out.print(i + "" + aArray[2]);
    }
    public static int aMeth(int[] iArray)
     {
     for (int i = 0; i < iArray.length; i++)
     {
     iArray[i]++;
     }
     int[] bArray = { 5, 6, 7, 8 };
     iArray = bArray;
     return iArray[2];
    }
     
     

1 points   

QUESTION 7

  1. Assuming that array myList is properly declared and initialized with values, what best describes the following code snippet?

    double max = myList[0];

    for (int i = 1; i < myList.length; i++) {

    if (myList[i] > max) max = myList[i];

    }

    sets max to the largest index in the array

    sets max to the index of the largest value in the array

    sets max to the largest positive value in the array

    sets max to the largest value in the array

1 points   

QUESTION 8

  1. Given the following two arrays, which of the following will copy the values from sourceArray into targetArray?

    int[] sourceArray = {2, 3, 1, 5, 10};

    int[] targetArray = new int[sourceArray.length];

    sourceArray = targetArray;

    targetArray = sourceArray;

    targetArray[] = sourceArray[];

    sourceArray.copyInto(targetArray, 0, sourceArray.length);;

    None of the above

QUESTION 1

  1. An array is an object

    True

    False

1 points   

QUESTION 2

  1. To add a new element on to the end of an array myArray,

    assign a new value to element myArray[myArray.length]

    use the myArray.add method

    use the myArray.resize method followed by the myArray.add

    new elements can't be added on to the end of an array

1 points   

QUESTION 3

  1. Assume myArray is a valid and instantiated array of int values. Also assume the user is asked for an int value arIndx, and enters -1.

    myArray[arIndx] = 3;

    will

    set the [-1] element of myArray to 3, even though this memory isn't in myArray's memory

    cause a compiler error

    cause a runtime exception

    renumber myArray's elements to be from -1 to myArray.length-2   

1 points   

QUESTION 4

  1. Note: Multiple Answer

    Which of the following will add 1 to each element of an appropriately declared, created and initialized int[] iVals?

    int i = iVals.length - 1;
    while (i >= 0)
    {
     iVals[i]++;
     i--;
    }
    for (int i: iVals)
    {
     i = i + 1;
    }
    for (int i: iVals)
    {
     iVals[i]++;
    }
     
    for (int i = 0; i < iVals.length; i++)
    {
     iVals[i] += 1

QUESTION 9

  1. In order to perform a binary search on an array, which of the following must be true (select all that apply)?

    The array must be ordered

    The array must contain integers

    The array must have an even number of elements

    The array must have an odd number of elements

1 points   

QUESTION 10

  1. Command line arguments are made available to main() via an array of _______.

1 points   

QUESTION 11

  1. The first action performed in a binary search is

    Determine the largest value in the array

    Determine the smallest value in the array

    Determine the mid-point of the array

    Determine if the array is sorted

1 points   

QUESTION 12

  1. If an array contains unordered values, searching for a particular value

    is accomplished with a linear search

    is accomplished with the bipolar search

    can't be done in Java

    requires multiple parallel processing threads

1 points   

QUESTION 13

  1. What best describes the processing of the following method?

    public static int[] mystery(int[] list) {

    int[] result = new int[list.length];

    for (int i = 0, j = result.length - 1;

           i < list.length; i++, j--) {

        result[j] = list[i];

    }

    return result;

    }

    Returns an array with the values from list sorted in ascending order

    Returns an array with the values from list sorted in descending order

    Returns an array with the values from list decremented by 1

    Returns an array with the values from list reversed

1 points   

QUESTION 14

  1. The first action performed in Selection Sort is

    convert all values to integers

    find the largest value in the array

    locate the midpoint of the array

    find the smallest value in the array

1 points   

QUESTION 15

  1. When Selection Sort is run against an array the end result is

    the values in the array are reordered smallest to largest

    the array is unchanged because the sorted values are placed in a different array

    none of the other answers are correct

    the values in the array are reordered largest to smallest

In: Computer Science