Questions
Discuss the security features in SNMPV3 that SNMPV1 and SNMPV2 do not provide

Discuss the security features in SNMPV3 that SNMPV1 and SNMPV2 do not provide

In: Computer Science

SQL Trigger problem When attemptiing to Create or Replace a trigger I get the error "sql...

SQL Trigger problem

When attemptiing to Create or Replace a trigger I get the error "sql warning trigger created with compilation errors".

Trigger:

CREATE OR REPLACE TRIGGER Late_Fees
after UPDATE
ON InventoryItem
FOR EACH ROW

DECLARE

late_fee number;
num_days number;
BEGIN
num_days:= to_date(:old.ReturnDate)-TO_DATE(:old.DateDue);
select IntValue into late_fee from ApplicationSettings where Setting='Daily Late Fee';
:new.fee := (late_fee)*(num_days);

END;
/

commit;

Table:

create table Rental(
INVID int Primary key,
LoanDate date,
PatronID int,
DueDate date,
ReturnDate date,
constraint PatronID_FK Foreign key (PatronID) references Patrons(PatronID));

Test Input:

insert into rental
values ('1345', '2020-02-20', '000', '2020-02-27', '2020-02-22');
insert into rental
values ('1345', '2020-04-10', '000', '2020-04-17', '2020-04-17');
insert into rental
values ('1234', '2020-02-20', '000', '2020-02-27', '2020-02-22');
insert into rental
values ('1245', '2020-02-20', '000', '2020-02-27', '2020-02-22');
insert into rental
values ('1345', '2020-08-14', '0001', '2020-08-21', '2020-08-20');
insert into rental
values ('1265', '2020-09-01', '0001', '2020-09-08', '2020-09-10');

In: Computer Science

A palindrome is a string that reads the same forward and backward, for example, radar, toot,...

A palindrome is a string that reads the same forward and backward, for example, radar, toot, and madam. Your task is to construct a python algorithm to receive as input a string of characters and check whether it is a palindrome using a stack and a queue. Your ADTs contains the following methods:

Queue

  • Queue() – constructor
  • enqueue(e) – enqueue an element
  • dequeue(e) – dequeue an element
  • len() – returns the number of elements in the queue

Stack

  • Stack() - constructor
  • push(e) – adds an element into the stack
  • pop(e) – removes an element of the stack
  • len() – returns the number of elements in the queue

Please explain the solution with details and document the code.

In: Computer Science

Let A[1 · · · n] be an array of n elements and B[1 · ·...

Let A[1 · · · n] be an array of n elements and B[1 · · · m] an array of m elements. We assume that mn. Note that neither A nor B is sorted. The problem is to compute the number of elements of A that are smaller than B[i] for each element B[i] with 1 ≤ im.

For example, let A be {30, 20, 100, 60, 90, 10, 40, 50, 80, 70} of ten elements. Let B be {60, 35, 73} of three elements. Then, your answer should be the following: for 60, return 5 (because there are 5 numbers in A smaller than 60); for 35, return 3; for 73, return 7.

(a) Design an O(mn) time algorithm for the problem. (10 points)

(b) Improve your algorithm to O(n log m) time. (20 points)
Hint: Use the divide and conquer technique. Since mn, you cannot sort the array A because that would take O(n log n) time, which is not O(n log m) as m may be much smaller than n.

Note: For this problem, you need to describe the main idea of your algorithms and briefly analyze their time complexities. You will receive the full 30 points if you give an O(n log m) time algorithm directly for (b) without giving any algorithm for (a).

In: Computer Science

Remember that great app you wrote for Yogurt Yummies (Lab 10-2). They want you to enhance...

Remember that great app you wrote for Yogurt Yummies (Lab 10-2). They want you to enhance the C++ console application that calculates and displays the cost of a customer’s yogurt purchase. Now they need to process multiple sales. Do not change any logic for handling a single sale. Make the following enhancements:

          ● Add "v2" to the application output header and close.

          ● Declare and initialize overall totals including:

                    ü Number of sales.

                    ü Overall number of yogurts sold.

                    ü Overall sale amount after discount.

                    ü Overall tax paid.

                    ü Overall sale total.

          ● Enclose the logic for a single sale with a sentinel loop that continues to process sales until the user enters 'n'.

          ● After calculating sale totals, update overall totals.

          ● When the user enters the sentinel value ('n'), print overall totals using formatted output manipulators (setw, left/right). Run the program with invalid and valid inputs, and at least three sales. The output should look like this:

Welcome to Yogurt Yummies, v2

-----------------------------

Enter another yogurt purchase (y/n)? y

Sale 1

----------------------------------------

Enter the number of yogurts purchased (1-9): 11

Error: '11' is an invalid number of yogurts.

Enter the number of yogurts purchased (1-9): 2

Enter the percentage discount (0-20): 22

Error: '22.00' is an invalid percentage discount.

Enter the percentage discount (0-20): 4

Yogurts:                             2

Yogurt cost ($):                  3.50

Discount (%):                     4.00

Subtotal ($):                     7.00

Total after discount ($):         6.72

Tax ($):                          0.40

Total ($):                        7.12

Enter another yogurt purchase (y/n)? y

Sale 2

----------------------------------------

Enter the number of yogurts purchased (1-9): 5

Enter the percentage discount (0-20): 10

Yogurts:                             5

Yogurt cost ($):                  3.50

Discount (%):                    10.00

Subtotal ($):                    17.50

Total after discount ($):        15.75

Tax ($):                          0.94

Total ($):                       16.70

Enter another yogurt purchase (y/n)? y

Sale 3

----------------------------------------

Enter the number of yogurts purchased (1-9): 7

Enter the percentage discount (0-20): 20

Yogurts:                             7

Yogurt cost ($):                  3.50

Discount (%):                    20.00

Subtotal ($):                    24.50

Total after discount ($):        19.60

Tax ($):                          1.18

Total ($):                       20.78

Enter another yogurt purchase (y/n)? n

Overall totals

========================================

Sales:                               3

Yogurts:                            14

Total after discount ($):        42.07

Tax ($):                          2.52

Total ($):                       44.59

End of Yogurt Yummies, v2

This is from yogurt Yummies V1

Welcome to Yogurt Yummies

-------------------------

Enter the number of yogurts purchased (1-9): 12

Error: '12' is an invalid number of yogurts.

Enter the number of yogurts purchased (1-9): 4

Enter the percentage discount (0-20): 30

Error: '30.00' is an invalid percentage discount.

Enter the percentage discount (0-20): 10

Yogurts:                             4

Yogurt cost ($):                  3.50

Discount (%):                    10.00

Subtotal ($):                    14.00

Total after discount ($):        12.60

Tax ($):                          0.76

Total ($):                       13.36

End of Yogurt Yummies

In: Computer Science

What steps would my computer have to go through to resolve the name cobalamin.csclub.uwaterloo.ca to an...

What steps would my computer have to go through to resolve the name cobalamin.csclub.uwaterloo.ca to an IPv4 using a full recursive query?

In: Computer Science

The following SinglyLinkedList class is available: class SinglyLinkedList: class _Node: """Lightweight, nonpublic class for storing a...

The following SinglyLinkedList class is available:

class SinglyLinkedList:
    class _Node:
        """Lightweight, nonpublic class for storing a singly linked node."""
        __slots__ = 'element', 'next'       # streamline memory usage

        def __init__(self, element, next):  # initialize node's fields
            self.element = element          # reference to user's element
            self.next = next                # reference to next node

    def __init__(self):          # initialize list's fields
        self._head = None        # head references to None

    def printList(self, label):
        print(label, end=' ')
        curr = self._head
        while curr != None:
            print(curr.element, end=" -> ")
            curr = curr.next
        print("/")

    #########################################################
    # Only this method is required for your solution
    def computeStats(self):
        # Your code goes here

    #########################################################

def main():
    # Create a list object for testing purpose
    sList = SinglyLinkedList()

    # Create list 2 -> 4 -> -1 -> 8 -> -5
    sList._head = sList._Node(2, sList._Node(4, sList._Node(-1, sList._Node(8, sList._Node(-5, None)))))
    sList.printList("before:")

    # Call computeStats method
    sList.computeStats()

    # And see if it worked!
    sList.printList("after :")

if __name__=="__main__":
    main()

Assume you have a singly-linked list of integers, some positive and some negative. Write a Python method that traverses this list to calculate both the average and the count (ie, number) of the odd values only. Once calculated, add the average to a new node at the front of the list, and the count to a new node at the end of the list. You may assume that the list will always contain at least one odd value.

Your method will be have the following method signature:

def computeStats(self):

You may use only the SinglyLinkedList class; no other methods (like size(), etc) are available.

For example, if the list initially contains:

2 → 4 → -1 → 8 → -5

the resulting list will contain:

-3.0 → 2 → 4 → -1 → 8 → -5 → 2

In: Computer Science

Explain in detail how is Machine Learning part of face mask detection?

Explain in detail how is Machine Learning part of face mask detection?

In: Computer Science

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By...

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1,2,3,5,8,13,21,34,55,89,...
By considering the terms in the Fibonacci sequence whose values do not exceed 1000, find the sum of
the all the terms up to 300.

In: Computer Science

How do i remove the decimals out of the output? Do I need to int a...

How do i remove the decimals out of the output? Do I need to int a new value, or use Math.round?

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
double numbers[] = new double[5];
  
inputArray(numbers);
maxNumber(numbers);
minNumber(numbers);
}
  
public static void inputArray( double[] numbers) {
Scanner in = new Scanner(System.in);
  
for(int i = 0; i < numbers.length; i++) {
numbers[i] = in.nextDouble();
}
}
  
public static void maxNumber(double[] numbers) {
double maxNum = numbers[0];
  
for(int i = 0; i < numbers.length; i++) {
if(numbers[i] > maxNum ) {
maxNum = numbers[i];
}
}
  
System.out.println("Max: "+maxNum);
}
  
public static void minNumber(double[] numbers) {
double minNum = numbers[0];

for(int i = 0; i < numbers.length; i++) {
if(numbers[i] < minNum ) {
minNum = numbers[i];
}
}
  
System.out.println("Min: "+minNum);
}
}

In: Computer Science

Create a C++ program which will prompt the user to enter a password continually until the...

Create a C++ program which will prompt the user to enter a password continually until the password passes the following tests.

Password is 6 chars long

Password has at least 1 number

If the input does not match the tests, it will input a specific error message. "Pass must be 6 chars long."

If the input is allowed, print a message saying "Correct Password Criteria."

In: Computer Science

Algorithm design:Suppose that three types of parentheses are allowed in an expression: parentheses, square brackets, and...

Algorithm design:Suppose that three types of parentheses are allowed in an expression: parentheses, square brackets, and curly braces. Please design an efficient algorithm to determine whether the parentheses in the expression are correctly paired. Please write down the algorithm idea and steps.

Please explain what kind of data structure is used to solve the problem, and then give the specific algorithm steps

In: Computer Science

Hello. I'm trying to write down java code making stars whose numbers are determined by user...

Hello. I'm trying to write down java code making stars whose numbers are determined by user input on the console (each star's data are stored in ArrayList).

the class extends JFrame and its color, size(Zoom in and Zoom out), and location are changing every time.

Moreover, its angular rotation is changed at a certain determined degree.

Does anyone know how to write down the java code of this question?

In: Computer Science

Describe domain concept briefly. What are the benefits of domain infrastructure when comparing to workgroup networking?...

Describe domain concept briefly. What are the benefits of domain infrastructure when comparing to workgroup networking? Your elaboration using live example is required.

In: Computer Science

1 Demonstrate the use of local variables in a Java program that has 1 function 2...

1
Demonstrate the use of local variables in a Java program that has
1 function

2
Demonstrate the use of overloaded methods
each has three primitive parameters
two methods computes and returns the product to the calling method for printing
one method computes and prints the product; does not return a result

3
Demonstrate the use of overloaded constructors
Three constructors each initialize two variables
Three methods, 1 computes the radius of a circle, 1 computes the area of a rectangle, and area of sphere

In: Computer Science