Questions
Convert the Queue to Generic implementation: public class MyQueueImpl implements MyQueue {    private int capacity;...

Convert the Queue to Generic implementation:

public class MyQueueImpl implements MyQueue {
   private int capacity;
   private int front;
   private int rear;
   private int[] arr;
   public MyQueueImpl(int capacity){
       this.capacity = capacity;
       this.front = 0;
       this.rear = -1;
       this.arr = new int[this.capacity];
   }
   @Override
   public boolean enQueue(int v) {      
           if(this.rear == this.capacity - 1) {
               //Perform shift
               int tempSize = this.size();
               for(int i=0; i < tempSize; i++) {
                   arr[i] = arr[front];
                   front++;
               }
               front = 0;
               rear = tempSize - 1;
           }
           this.rear ++;
           arr[rear] = v;
           return true;
   }
   @Override
   public int deQueue() {
       return arr[front++];
      
   }
   public String toString() {
       String content = "Queue :: ";
      
       for(int i=front; i<= rear; i++) {
           content += "\n" + arr[i];
       }
       return content;
   }
   @Override
   public boolean isFull() {
       return (this.size() == this.capacity);
   }
   @Override
   public int size() {
       return rear - front + 1;
   }
   @Override
   public boolean isEmpty() {
       // TODO Auto-generated method stub
       return (this.size() == 0);
   }
   @Override
   public int peek() {
       // TODO Auto-generated method stub
       return this.arr[this.front];
   }
}

In: Computer Science

Linux Have your script request a word from the user, then checks if it is an...

Linux

Have your script request a word from the user, then checks if it is an ordinary file. If yes display the size of the file. If the name is a directory, then display the number of objects in that directory, then display the second line of a long listing of that directory.

In: Computer Science

in assemby, please share code and output - thanks 1. First clear all your general purpose...

in assemby, please share code and output - thanks

1. First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register and making sure NOT to overwrite them in the process. After, create another label L2 that adds all these values together and at the end of your program make sure your ECX register contains the final value. Call the DUMPREGS instruction to display your register values and move the final result into the Result variable.

2. Use the following code below as a template and follow the instructions written in the comments ;Assume I have the following data segment written: .data val1 BYTE 10h val2 WORD 8000h val3 DWORD 0FFFFh val4 WORD 7FFFh ;1. Write an instruction that increments val2. ;2. Write an instruction that subtracts val3 from EAX. ;3. Write instructions that subtract val4 from val2. .code ;Write your instructions here

In: Computer Science

Compare radixSort to bubbleSort, SelectionSort, and InsertionSort Compare quickSort to bubbleSort, SelectionSort, and InsertionSort

Compare radixSort to bubbleSort, SelectionSort, and InsertionSort

Compare quickSort to bubbleSort, SelectionSort, and InsertionSort

In: Computer Science

what is the operation for DragonFly BSD DragonFly BSD os structure

what is the operation for DragonFly BSD

DragonFly BSD os structure

In: Computer Science

Write a function lbs2lboz(p) that takes a non-negative number, p , that represents a weight in...

Write a function lbs2lboz(p) that takes a non-negative number, p , that represents a weight in pounds and outputs a pair (l,o) such that l is an integer and p=l+o/16.

Write a function oz2lboz(oz) that takes a non-negative number, oz , that represents a weight in ounces and outputs a pair (l,o) such that l is an integer and oz=l*16+o.

on python

In: Computer Science

What are the three types of processor scheduling? What is the difference between turnaround time and...

What are the three types of processor scheduling?

What is the difference between turnaround time and response time?

What is the difference between preemptive and non-preemptive scheduling?

Is a non-preemptive scheduling approach a good choice for interactive systems? Why?

What is the meaning of the term: feedback scheduling?

In: Computer Science

IN JAVA Methods**: Sort three values Write a method Ascend3 with an array of integers of...

IN JAVA

Methods**: Sort three values

Write a method Ascend3 with an array of integers of size three as the parameter, that sorts the values of the array into ascending order. Ex: If the array contains [5, 2, 7], after the call Ascend3(int[] vals), the array will now hold [2, 5, 7].

Hints:

  • Return type should be void.

  • One approach puts the three values into an array, then sorts the array. We won't be describing that approach here. Instead, we'll use branches.

  • One solution approach realizes that only 6 possible orderings of xyz exist: xyz, xzy, yxz, yzx, zxy, zyx. An if-else can be used to detect which order x, y, z are initially in.

  • Once detected, three variables lowVal, midVal, and highVal can be assigned. Note: Don't assign the parameter right away, because you'll overwrite a value that is still needed.

  • After the if-else, those lowVal, midVal, and highVal variables are ready. So just set the vals[0] with lowVal, vals[1] with midVal, and vals[2] with highVal.

  • Be aware that two values could be equal. So use <= rather than < in your comparisons.

GIVEN CODE:

import java.util.Scanner;

public class Main {

// Define Ascend3() here

public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int[] arrVals = new int[3];
  
arrVals[0] = scnr.nextInt(); // x
arrVals[1] = scnr.nextInt(); // y
arrVals[2] = scnr.nextInt(); // z
  
Ascend3(arrVals);
  
System.out.println(arrVals[0] + " " + arrVals[1] + " " + arrVals[2]);
}
}

In: Computer Science

Implement the earse one() function by using the array shifting method (i.e., remove one target item...

Implement the earse one() function by using the array shifting method (i.e., remove one target item and shift all right items one position left).

In: Computer Science

How does a value-returning function differ from the void functions? in pyhton

How does a value-returning function differ from the void functions? in pyhton

In: Computer Science

How are the security vulnerabilities found on Microsoft Windows systems different or similar with those found...

  • How are the security vulnerabilities found on Microsoft Windows systems different or similar with those found on Linux systems? Which operating environment is more vulnerable and what is the basis of your assertion? How would these differences or similarities impact the work of a security administrator?
  • Are virtual private networks (VPNs) always secure? What could make a VPN environment vulnerable to attacks? And how would defense-in-depth and creating a layered-technology approach enhance VPN networks?

In: Computer Science

Please re-write paragraphs. -In the following slides I will be discussing the three different methods that...

Please re-write paragraphs.

-In the following slides I will be discussing the three different methods that are for determining the requirements for gathering information. I will discuss the advantages and disadvantages of each method, along with explaining the Level-0 Data Flow Diagram, the last thing I will be discussing is the method in which I chose for determining the requirements for the student furniture webstore that the Pine Valley Furniture store decided to plan and implement first.

- The above slide has the three different methodologies listed that are used for requirements gathering. They are the traditional, contemporary, and radical methodologies. I am going to discuss what’s involved in each methodology along with what are the advantages and disadvantages of each methodology.

- The traditional method of doing things is the old way of doing things in which many organizations still use today. I think this method should still be used to some extent because I feel you still get good solid information and feedback from your users. In the traditional way the organization can interview people to see what the ”issues and operation of the current system” and the system coming. (Valacich & George, 2020, p. 148) Traditionally you would interview a lot of different people that have different “needs to find synergies and contrasts among system requirements “(Valacich & George, 2020, p. 148) One of my favorite traditional methods are sitting in on workers as during their daily routine and seeing how they perform their daily tasks and what other tools they need to accomplish them. One last traditional method is to go over old “business documents” so that the organization can see “issues, policies, rules, and directions”. The traditional method also has (examples that are solid that show the use of the organizations data and information). The advantages of traditional methodology are you will get more (solid and correct information from your users when you observe them during their daily work tasks, when the documentation and procedures are analyzed they will give information about the organization as well as identifying the current system requirements, it allows the analyst to work with having the procedures and documentation in front of them to refer back to, the documentation will list everyone who is involved in the current system.)The disadvantages of directly observing employees are that it can be (costly and take up too much time, procedures come up missing, users are repeating what’s already been done, the procedures and documents being analyzed may need to be updated along with they may be hard to find, and one last disadvantage is that the documents and procedures may say one thing about operation but the organization operates in an entirely whole different way.

- The contemporary method is similar to the traditional method. In the contemporary method is where “managers, analysts, users, and other members” that are needed are brought together in a JAD which is a Joint Application Design that is an arraigned process where “very intense meetings” take place to identify and go over the “systems requirements.” (Valacich & George, 2020, p. 159-160) The other thing that happens during use of a contemporary method are (prototypes are developed for the system that clearly define the system requirements are understood in solid terms by showing working versions of system features.) (Valacich & George, 2020) The advantages of the contemporary methodology are in using the Joint Application Design it will allow the users to effectively take place in the process, the organization will have a more solid and precise statement of the systems requirements, and everyone will have a better comprehension of the organizations goals.) ("Prezi", 2020). Some other advantages of the contemporary methodology are in using prototyping because this is where at the (beginning stages of the development prototyping lets the identification of the potential risks involved and to rectify the errors, also when the “developers and testers” are making the prototype they can very easily make it to accommodate what the customer wants and needs with being able to make adjustments when necessary, as well as when showing it to the customer this is the perfect way to do so, and when using prototyping the “developers have a great chance of getting much wanted “valuable feedback” from the users so this will save them a great deal of time, effort, and money down the road. According to "Velvetech"(2020), The disadvantages of using the contemporary method are in using the (JAD) Joint Application Design is the more expensive way to go because there are many more people involved and there is not enough resources available.) ("Prezi", 2020). The disadvantages of using prototypes are that “the initial result of a prototype is never the market-ready product”, (making changes all the time will make so there are many designs and changes within the code, and this will slow down the flow in which the employees are doing their tasks), ("Velvetech", 2020) and sometimes “software vendor that covers for the cost of a prototype.” According to "Velvetech"(2020),

In: Computer Science

1. (A) A Web server is identified by port number 25 while an email server process...

1.

(A) A Web server is identified by port number 25 while an email server process using the SMTP protocol is identified by port number 80.

True

False

(b) Both SMTP with HTTP are used to transfer files from one host to another.

True

False

(c) We are sending a 30 Mbit MP3 file from a source host to a destination host. All links in the path between source and destination have a transmission rate of 10 Mbps. Assume that the propagation speed is 2*108 meters/sec, and the distance between source and destination is 10,000 km. Now suppose there is only one link between source and destination. Also suppose that the entire MP3 file is sent as one packet. How many bits will the source have transmitted when the first bit arrives at the destination?

A.

30,000,000 bits

B.

1 bit

C.

500,000 bits

D.

none of the above

(d) Suppose a client sends an HTTP request message with the "If-modified-since": header. Suppose the object in a server has not changed since the last time a client retrieved the object. Then the server will send a response message with the status code ____.

A.

200 OK

B.

404 Not Found

C.

304 Not Modified

D.

none of the above

(e) UDP provides a flow-control service to its applications to eliminate the possibility of the sender overflowing the receiver’s buffer.

True

False

(F)The TCP connection is not an end-to-end TDM or FDM circuit as in a packet-switched network.

True

False

In: Computer Science

Write a program to multiply a polynomial with a given number. Code needed in java.

Write a program to multiply a polynomial with a given number.

Code needed in java.

In: Computer Science

LAUNGEG: C# Objective: For this assignment you will be creating two classes, an interface, and a...

LAUNGEG: C#

Objective:

For this assignment you will be creating two classes, an interface, and a driver program:

  • Class Calculator will implement the interface CalcOps
    o As such it will implement hexToDec() - a method to convert from

    Hexadecimal to Decimal.

  • Class HexCalc will inherit from Calculator.

  • Interface CalcOps will have abstract methods for add( ), subtract( ),

    multiply( ) and divide( ).

  • Both classes will implement the CalcOps interface.

o Class Calculator’s add, subtract, multiply and divide will take in 2 integers and return an integer. If you prefer it can take in 2 strings, and return a string.

o Class HexCalc’s add, subtract, multiply and divide will take in 2 strings (hexadecimal numbers) and return a string (hexadecimal number).

This Calculator class will work with whole numbers (int) and hexadecimal (String) values. The hexToDec ( ) method is a helper method included in interface CalcOps, that requires the Calculator class to implement the method which converts hexadecimal numbers to decimal. (Hint: Use language specific utility methods to convert hexadecimal to decimal.)

Submission Guidelines:

Program code – 1 interface program, 2 Classes and a driver program UML diagram - PDF format.

Assignment Requirements:

  • Create a parent class calculator that implements the arithmetic operations. You may use input values of integers or Strings.

  • Implement method public int hexToDec (String hexValue) which converts hexadecimal numbers to decimal numbers in the parent calculator class.

  • Create a class hexCalc which is a child class of the calculator class

o This class performs basic arithmetic operations such as addition,

subtraction, multiplication and division on hexadecimal numbers by

reusing the methods in parent class.
o To do hexadecimal arithmetic, convert the hexadecimal values to

integers, perform the arithmetic operation using the parent class methods

and then convert the result back to hexadecimal string.
o For conversion between hexadecimal and integer values use the

following language specific methods.

C#

Convert.ToString(int,16) Convert integer to hexadecimal

Convert.ToInt32(hex, 16) Convert hexadecmial to integer

  • Run the driver program for all calculator operations using decimal and hexadecimal values.

  • The biggest challenge you will run into in this assignment will be calling methods with the correct data types as parameters to each method. If you are

getting errors, be sure to double check that what you passed to the method as arguments matches the methods parameter types. Where possible, use your language’s methods to convert to the appropriate type before calling.

• Be sure to convert from integers to strings and vice versa before and after converting from decimal to hex.

Skeleton:

//Design an interface public interface CalcOps

{
// ... includes basic arithmetic operations

 public int hexToDec (String hexToDecimal) ;

}

//Parent class

public class Calculator implements CalcOps

{

}

//Hexadecimal arithmetic calculator that extends calculator

public class HexCalc extends Calculator{
@implement add, subtract, multiply, divide methods

//Reuse parent class methods.

}

public class TestCalculator {

//Provide choice between executing hexadecimal and decimal arithmetic //operations.

// Menu of choices

} // Driver class.

OUTPUT:

Would you like to do calculations with decimal or hexadecimal numbers (1 for Decimal, 2 for Hexadecimal

1

---MENU---
0 - Exit
1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
Please Choose an Option: 1 Please enter the first number

45

Please enter the second number

67

112 ---MENU---

0 - Exit
1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
Please Choose an Option: 2 Please enter the first number

34

Please enter the second number

1

33

---MENU---
0 - Exit
1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
Please Choose an Option: 3 Please enter the first number

23

Please enter the second number

12

276

---MENU---
0 - Exit
1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
Please Choose an Option: 4 Please enter the first number

10

Please enter the second number

3

3

---MENU---
0 - Exit
1 - Addition
2 - Subtraction
3 - Multiplication 4 - Division

Please Choose an Option: 0
You chose to Exit> THANK YOU !!! HAVE A GREAT DAY!!

Thank you!

In: Computer Science