Questions
Determine the computational complexity of the following language: 0n1n "Computational complexity theory focuses on classifying computational...

Determine the computational complexity of the following language:

0n1n

"Computational complexity theory focuses on classifying computational problems according to their inherent difficulty, (how difficult they are to solve) and relating these classes to each other. A computational problem is a task solved by a computer. Some computational problems are impractical as the known algorithm takes too much time and memory to complete."

In: Computer Science

(PLEASE EXPLAIN ANSWER AND SHOW STEPS IF POSSIBLE) Q)An administrator is working with the 192.168.4.0 network,...

(PLEASE EXPLAIN ANSWER AND SHOW STEPS IF POSSIBLE)

Q)An administrator is working with the 192.168.4.0 network, which has been subnetted with a /27 mask. Which two addresses can be assigned to hosts within the same subnet? (Choose two)

  1. 192.168.4.30
  2. 192.168.4.31
  3. 192.168.4.32
  4. 192.168.4.33
  5. 192.168.4.36

Q)The network address of 172.16.0.0/20 provides how many subnets and hosts?

  1. 7 subnets, 30 hosts each
  2. 16 subnets, 8,190 hosts each
  3. 16 subnets, 4,094 hosts each
  4. 7 subnets, 2,046 hosts each

Q)Given the following IP address from the Class B address range using the default subnet mask: 100.110.0.0. Your network plan requires no more than 64 hosts on a subnet. When you configure the IP address in Cisco IOS software, which value should you use as the subnet mask?

  1. 255.255.0.0
  2. 255.255.128.0
  3. 255.255.255.128
  4. 255.255.255.252

In: Computer Science

This is a Java program that I am having trouble making. 1- Search for the max...

This is a Java program that I am having trouble making.

1- Search for the max value in the linked list.

2- Search for the min value in the linked list.

3- Swap the node that has the min data value with the max one. (Note: Move the nodes to the new positions).

4- Add the min value and the max value and insert the new node with the calculated value before the last node.

I already made a generic program that creates the linked list and has the ability to add and remove from the list. I am not sure how to create these generic methods though.

Below is my attempt to make the min finder, but it does not work and gives me an error on the bolded parts. It says "bad operand types for binary operator >".

LList.java below:


package llist;

/**
*
* @author RH
* @param <E>
*/
public class LList<E> {

Node head, tail;
int size;

public LList() {
size = 0;
head = tail = null;
}

public void addFirst(E element) {
Node newNode = new Node(element);
newNode.next = head;
head = newNode;
size++;
if (tail == null) {
tail = head;
}
}

public void addLast(E element) {
Node newNode = new Node(element);

if (tail == null) {
head = tail = newNode;
} else {
tail.next = newNode;
tail = tail.next;
}
size++;
}

public void insert(int index, E element) {

if (index == 0) {
addFirst(element);
} else if (index >= size) {
addLast(element);
} else {
Node current = head;

for (int i = 1; i < index; i++) {
current = current.next;
}

Node holder = current.next;
current.next = new Node(element);
current.next.next = holder;
size++;
}
}

public void remove(int e) {
if (e < 0 || e >= size) {
System.out.println("Out of bounds");
} else if (e == 0) {
System.out.println("Deleted " + head.element);
head = head.next;
size--;
} else if (e == size - 1) {
Node current = head;
Node holder;
for (int i = 1; i < size; i++) {
current = current.next;
}
System.out.println("Deleted " + current.element);
tail.next = current.next;

tail = tail.next;
size--;
} else {
Node<E> previous = head;
for (int i = 1; i < e; i++) {
previous = previous.next;
}

System.out.println("Deleted " + previous.next.element);

Node<E> current = previous.next;
previous.next = current.next;
size--;
}
}

public int largestElement() {

int max = 49;

while (head != null) {

if (max < head.next) {
max = head.next;
}
head = head.next;
}
return max;
}

public int smallestElement() {

int min = 1001;

while (head != null) {

if (min > head.next) {
min = head.next;
}

head = head.next;
}
return min;
}

public void print() {
Node current = head;

for (int i = 0; i < size; i++) {
System.out.println(current.element);
current = current.next;
}
}
}

Node.java below:

package llist;

/**
*
* @author RH
* @param <E>
*/
public class Node<E> {

E element;
Node next;
  
public Node(E data) {
this.element = data;
}   
}

Driver.java below:

package llist;
import java.util.concurrent.ThreadLocalRandom;
/**
*
* @author RH
*/
public class Driver {
public static void main(String[] args) {
LList<Integer> listy = new LList();
  
// adds 10 random numbers to the linkedlist
for (int i = 0; i < 10; i++) {
listy.addFirst(ThreadLocalRandom.current().nextInt(50, 1000 + 1));
}
  
  
System.out.println("");
  
listy.print();
  
System.out.println("");
  
int max = listy.largestElement();
  
int min = listy.smallestElement();
  
System.out.println(max);
  
System.out.println(min);
//listy.remove(1);
  
//System.out.println("");
  
//listy.print();
}
  
}

I am not sure how to get these generic methods made.

In: Computer Science

C++ Drink Machine Simulator Create a class that simulates and manages a soft drink machine. Information...

C++

Drink Machine Simulator
Create a class that simulates and manages a soft drink machine. Information on each drink
type should be stored in a structure that has data members to hold the drink name, the
drink price, and the number of drinks of that type currently in the machine.
The class should have an array of five of these structures, initialized with the following data.

Drink Name      Cost   Number in Machine
Cola       1.00   20
Root beer          1.00       20
Orange soda    1.00       20
Grape soda      1.50 20
Bottled water    1.50       20

The class should have two public member functions, displayChoices (which displays a
menu of drink names and prices) and buyDrink (which handles a sale). The class should
also have at least two private member functions, inputMoney, which is called by buyDrink
to accept, validate, and return (to buyDrink) the amount of money input, and
dailyReport, which is called by the destructor to report how many of each drink type
remain in the machine at the end of the day and how much money was collected.

You may want to use additional functions to make the program more modular.
The client program that uses the class should have a main processing loop which calls the
displayChoices class member function and allows the patron to either pick a drink or
quit the program. If the patron selects a drink, the buyDrink class member function is
called to handle the actual sale. This function should be passed the patron’s drink choice.


Here is what the buyDrink function should do:
• Call the inputMoney function, passing it the patron’s drink choice.
• If the patron no longer wishes to make the purchase, return all input money.
• If the machine is out of the requested soda, display an appropriate “sold out” message and return all input money.
• If the machine has the soda and enough money was entered, complete the sale by updating the quantity on hand and money collected information, calculating any change due to be returned to the patron, and delivering the soda.

This last action can be simulated by printing an appropriate “here is your beverage” message.
Input Validation: Only accept valid menu choices. Do not deliver a beverage if the
money inserted is less than the price of the selected drink.

TEST CASE1:

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 1
How much money has been inserted: $5
Do you still want to make a purchase? (Y / N) : y
Here is your Cola, and your change of $4.00

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 2
How much money has been inserted: $6
Do you still want to make a purchase? (Y / N) : y
Here is your Root Beer, and your change of $5.00

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 3
How much money has been inserted: $4
Do you still want to make a purchase? (Y / N) : y
Here is your Orange Soda, and your change of $3.00

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 4
How much money has been inserted: $8
Do you still want to make a purchase? (Y / N) : y
Here is your Grape Soda, and your change of $6.50

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 5
How much money has been inserted: $3
Do you still want to make a purchase? (Y / N) : y
Here is your Bottled Water, and your change of $1.50

Drink Machine Menu
1. Cola          : $1.00
2. Root Beer     : $1.00
3. Orange Soda   : $1.00
4. Grape Soda    : $1.50
5. Bottled Water : $1.50
6. Quit Drink Machine 
Please make a selection : 6
Thank you for shopping!

Drink Machine Daily Report
Cola           : 19
Root Beer      : 19
Orange Soda    : 19
Grape Soda     : 19
Bottled Water  : 19
Total amount collected : $6.00

In: Computer Science

You would like to establish a WAN connectivity between your local offices across town. You are...

You would like to establish a WAN connectivity between your local offices across town. You are considering the use of a wireless solution. Complete and document research on the technology available to support the establishment of a WAN. Your document should address the following:

  • At least 2 available solutions
  • Benefits of this form of implementation
  • Costs associated with the implementation of each solution
  • A summary of 2–3 paragraphs stating which solution you have decided to implement and what motivated the decision

In: Computer Science

#1 Write a loop that displays every fifth number, 0 through 100. #2 Write a do-...

#1 Write a loop that displays every fifth number, 0 through 100.

#2 Write a do- while loop that asks the user to enter two numbers. The number should be added and the sum displayed. The user should be asked if he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate.

#3 Write a nested loop that displays 10 rows of '#' characters. There should be 15 '#' characters in each row.

#4 Write a while loop that displays the odd numbers between 1 and 15.

#5 Write a program segment with a do-while loop that displays whether a user- entered integer is even or odd. The code should then ask the user if he or she wants to test another number. The loop should repeat so long as the user enters Y or y. Use a logical OR operator in the do-while loop test expression.

In: Computer Science

Suppose you are provided with an array of integer values. Write pseudocode for a program to...

Suppose you are provided with an array of integer values. Write pseudocode for a program to determine how many unique values are in the array. Your solution should require time that is linearithmic in the size of the array.

(For example, if the array contains the values {1,3,4,1,2}, the answer is "4", because the array contains the values 1, 2, 3, and 4)

In: Computer Science

In assembly level, a code of loop structure can be either implemented using a \branch forward"...

In assembly level, a code of loop structure can be either implemented using a \branch forward" or a \branch backward" approach.
(a) Name the advantages and disadvantages using one versus the other, in terms
of speed, applicability, code size and other possible relevant factors. Clearly
explain your conclusion.
(b) For the following segment of C program, determine which approach is applicable, and then write the most efficient DLX assembly code for it. Assume r1 is
already assigned to x as a temporary register.
x=0;
for(i=0; i<100; i=i+3)
for(j=i; j<4*i; j++)
x=x*i+j

In: Computer Science

1. Design the logic for a program that outputs every multiple of 4, from 4 through...

1. Design the logic for a program that outputs every multiple of 4, from 4 through 100
along with its value squared and cubed, e.g.,
The next number: 4
Squared: 16
Cubed: 64
The next number: 8
Squared: 64
Cubed: 512

In: Computer Science

Create a web form that will accept a string as a password and determine the strength...

Create a web form that will accept a string as a password and determine the strength of that password. The strength of a password is determined by the characters making up the password. These characters are divided into three categories:

USING PHP

The uppercase characters, which are A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z The lowercase characters, which are a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
The special characters which are ~!@#$%^&*()_?+><

The strength of the password can be:

  • INVALID : if the string is less than 8 characters long or has invalid characters

  • POOR: if the string contains only one set of the above characters in it

  • MEDIUM: if the string contains only two sets of the above characters in it

  • GOOD: if the string contains all three sets of the above characters.

    T

  • Strength Message should display “INVALID”, “POOR”,”MEDIUM” or “GOOD”.

    For “INVALID”, “POOR” or ”MEDIUM” strengths give the reason(s) why. The Reason

is less than 8 characters”,
does not contain uppercase characters”
does not contain lowercase characters”
does not contain special characters”
does not contain uppercase or lowercase characters” does not contain uppercase or special characters” does not contain lowercase or special characters” contains uppercase, lowercase and special characters” contains invalid characters”

  • “Password

  • “Password

  • “Password

  • “Password

  • “Password

  • “Password

  • “Password

Message can be:

“Password

“Password

In: Computer Science

what is collision resolution technique? by giving an example explain in file processing

what is collision resolution technique? by giving an example explain in file processing

In: Computer Science

(Python) In a weather station, there is a sensor that measures the temperature three times a...

(Python) In a weather station, there is a sensor that measures the temperature three times a
day (in Celsius). Write a program that asks the user to input three numbers, corresponding to the
sensor's three readings for a particular day. Then, print the minimum, maximum and average value
of the three numbers.
Note: If one or two inputs are either less than -70, or greater than +50 degrees, you should ignore
those one or two inputs, and calculate the minimum, maximum and average using only the other
inputs. If all 3 inputs are either less than -70 or greater than 50, your code should print "Broken
sensor!" and not perform any calculations.
For this question, you must not use any built-in functions or functions from math
module except print(), input() or oat(). You must compute the minimum, maximum
and average values using if statement and arithmetic operators. This means that you
cannot use the built-in max() or min() functions.

In: Computer Science

1. Complete Programming Problem #14, Stadium Seating, on page 199 of the textbook. A revised form...

1. Complete Programming Problem #14, Stadium Seating, on page 199 of the textbook. A revised form (original form provided in Figure 3-49) is provided below based upon theAdditional Requirements. Data is also provided to test the application.

The ADDITIONAL REQUIREMENTS described below MUST also be implemented:

  • Apply the currency format string for displaying monetary output (i.e., displays a leading currency symbol, digits, comma separators, and a decimal point)
  • Apply the number format string for displaying non-monetary output with no decimal places (i.e., the precision must be specified)
  • Implement simple exception handling to catch any exceptions that are thrown and display the exception's default error message
  • Implement named constants where applicable (i.e., the cost of the different classes of seats)
  • Calculate the total tickets sold for each individual transaction
  • Implement the following fields:
    • Sum of revenue which accumulates the overall revenue (i.e., running sum of the Total Revenue)
    • Sum of Tickets which accumulates the total tickets (i.e., running sum of the Total Tickets)
    • Count of Transactions which counts the number of times the Calculate Revenue button is clicked (i.e., adding to the Count of Transactions)
  • Add the following Label controls to the form (Note: GroupBox controls are used to group the various TextBox and Label controls):
    • Total Tickets (descriptive and output)
    • Sum of Revenue (descriptive and output)
    • Sum of Tickets (descriptive and output)
    • Transactions (descriptive and output

This the instructions for my class and I am lost. Here is my code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _3333_SilmonD_Lab03
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
  

private void calRevButton_Click(object sender, EventArgs e)
{
double CATickets;
double CBTickets;
double CCTickets;
double totalRevenue;


  

if (classATicketsTextBox.Text != "" && classBTicketsTextBox.Text != "" && classCTicketsTextBox.Text != "")
{
CATickets = double.Parse(classATicketsTextBox.Text);
CBTickets = double.Parse(classBTicketsTextBox.Text);
CCTickets = double.Parse(classCTicketsTextBox.Text);

CATickets = CATickets * 15.0;
CBTickets = CBTickets * 12.0;
CCTickets = CCTickets * 9.0;

totalRevenue = CATickets + CBTickets + CCTickets;
  
classARevenueTextBox.Text = CATickets.ToString("c");
classBRevenueTextBox.Text = CBTickets.ToString("c");
classCRevenueTextBox.Text = CCTickets.ToString("c");
totalRevenueTextBox.Text = totalRevenue.ToString("c");
sumofRevenueTextBox.Text = totalRevenue.ToString("c");
  
}
}

private void clearButton_Click(object sender, EventArgs e)
{
classATicketsTextBox.Text = "";
classBTicketsTextBox.Text = "";
classCTicketsTextBox.Text = "";
classARevenueTextBox.Text = "";
classBRevenueTextBox.Text = "";
classCRevenueTextBox.Text = "";
totalRevenueTextBox.Text = "";
}

private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}

private void sumofRevenueTextBox_TextChanged(object sender, EventArgs e)
{

}

private void totalTicketsBox_TextChanged(object sender, EventArgs e)
{

}
}
}

In: Computer Science

For java code: Create a library to do it all. The attached file has all the...

For java code: Create a library to do it all. The attached file has all the directions and methods that need to be included in your library (.jar). You will create a .jar file, and a tester app that will include your .jar file (Add External JAR).

The attached file below:

Create a java project called MyLibrary, a package called net.dtcc.lib, and a class called AllInOne. The class should have the following methods, each method should return the answer:
Area:
Area of Rectangle
Area of Square
Area of Triangle
Area of Circle
Area of Trapezoid
Area of Ellipse
Area of Pentagon
Area of Parallelogram
Area of Rhombus
Area of Hexagon
Area of Polygon
** Pass in appropriate variables

Fractions:
Adding 2 fractions
Subtracting 2 fractions
Multiplying 2 fractions
Dividing 2 fractions
** Pass in numerator/denominator of first number; numerator/denominator of second number

Binary:
Binary to decimal conversion  
** Pass in binary number

Temperature:
Celcius to Fahrenheit
Celcius to Kelvin
Fahrenheit to Celcius
Fahrenheit to Kelvin
** Pass in temperature to be converted 

Volume:
Volume of Cube
Volume of Box
Volume of Cylinder
Volume of Cone
Volume of Sphere
** Pass in appropriate variables

Perimeter:
Perimter of Square
Perimeter of Rectangle
** Pass in appropriate variables

Circumference:
Circumference of Circle
** Pass in appropriate variables

Pythagorus Theorem:
** Pass in 2 values (a,b)

Once you have finished the class, create a library (.jar) file with the name Taz2015.jar

Next create another java project called Tester, a package called .net.dtcc.tester, and a class called LibTester. You will need to import your Taz2015.jar to the project (hint: remember derby.jar?). In this class, you should test each method in the library.

In: Computer Science

Dev c++ should be used to answer the question above. SCIMS at USP wants to maintain...

Dev c++ should be used to answer the question above.

SCIMS at USP wants to maintain student records using linked lists. The school currently offers 3 first-year courses which are CS100, CS101 and CS110. These courses are compulsory and are required by students to do in a semester. All courses have two assignments (20% each ), a mid-semester test (10%) and final exam (50%). The following file contains the students' records, course lists with appropriate marks. Student file contains students id number and name. Each course file contains students mark (assignment 1, assignment 2, MST and final exam). Beside each assessment in the file, the total mark for that particular assessment is given.

Student. Txt
ID Fname Lname
1234 David Dalton
9138 Shirley Gross
3124 Cynthia Morley
4532 Albert Roberts
5678 Amelia Pauls
6134 Samson Smith
7874 Michael Garett
8026 Melissa Downey
9893 Gabe Yu

CS100.txt
ID A1(50) A2(50) MST(30)FE(100)
1234 25 25 20 60
9138 15 30 10 50
3124 30 20 20 80
4532 36 47 30 90
5678 10 10 10 30
6134 45 50 25 20
7874 36 5 10 35
8026 47 2 12 40
9893 35 20 20 56

CS101.txt
ID A1(40) A2(30) MST(20)FE(100)
1234 15 25 20 50
9138 20 30 20 70
3124 40 20 20 80
4532 16 12 10 75
5678 10 10 10 30
6134 25 30 20 20
7874 36 5 10 35
8026 5 22 12 40
9893 35 20 20 56

CS110.txt
ID A1(30) A2(50) MST(30)FE(100)
1234 15 25 20 50
9138 20 30 20 70
3124 40 35 30 80
4532 16 12 10 75
5678 20 30 20 30
6134 25 30 20 20
7874 36 5 10 35
8026 5 22 12 40
9893 35 20 20 56

You are required to write a program for the school to do grade calculation and analysis using linked lists. The following criteria need to be used for grade calculation for each course:
Total Score Grade GPA
85 or more A+ 4.5
78 to 84 A 4
71 to 77 B+ 3.5
65 to 70 B 3
56 to 64 C+ 2.5
50 to 55 C 2
40 to 49 D 1.5
0 to 39 E 1
Please do note that if the student does not meet the minimum 40% mark in the final exam and the course total mark is above 50 then the student should be given a D grade.
Requirements
1. Draw the structure of the linked list using an appropriate tool with all relevant data from the file.
2. This problem must be solved using linked list. You have to use classes to create linked list.
3. The main program should be able to do the following:
 Create a linked list for each file and store the records of the file.
 Calculate the total mark and grade of a student for each course which must be stored in the list.
 Create a menu for the user that can do the following:
o Exit program
o Display all students for SCIMS
o Display the marks and grade for each course. The course code will be entered by the user.
o Display all students who got D grade because the minimum 40% was not met in the final exam. The display should include student ID, name, course code, total mark.
o Display all students who failed all three courses.
o Display students in each course who got A+.
o Calculate and display semester GPA for all students. Semester GPA is calculated by adding GPA for all courses and then divided by the number of courses.
o Delete a student record from all the linked lists. The program should prompt the student id number.
o Add a student record in all linked lists.
 Except the first menu, all others should be implemented using functions of the main program.

Dev c++ should be used to answer the question above.

In: Computer Science