Questions
Write down what you did to accomplish each task. 1. Inspect /etc/passwd find your account. 2....

Write down what you did to accomplish each task. 1. Inspect /etc/passwd find your account. 2. Inspect /etc/shadow. What is each field displaying? 3. Add a new user to your system. Call the user "user1" with password "user" . 4. How do you inspect your environment variables. 5. Install openssh server 6. Check to see if it is up and running.

In: Computer Science

using java write a program As the title described, you should only use two stacks to...

using java write a program

As the title described, you should only use two stacks to implement a queue's actions. DO NOT use any other data structure and push, pop and top should be O(1) by AVERAGE.
The queue should support push(element), pop() and top() where pop is pop the first(a.k.a front) element in the queue.
Both pop and top methods should return the value of first element

example

push(1)
pop() // return 1 push(2)
push(3)
top() // return 2 pop() // return 2

In: Computer Science

***JAVA LANGUAGE, NO CHANGES NEEDED FOR THE Movie CLASS. USE THIS AS A REFERENCE*** public class...

***JAVA LANGUAGE, NO CHANGES NEEDED FOR THE Movie CLASS. USE THIS AS A REFERENCE***

public class Movie {
private String title;
private int length;
private static int numMovies = 0;

public Movie() {
this("", 0);
}

public Movie(String title, int length) {
this.title = title;
this.length = length;
++numMovies;
}

public String getTitle() { return this.title; }
public int getLength() { return this.length; }
public static int getNumMovies() { return numMovies; }

public void setTitle(String title) {
this.title = title;
}

public boolean setLength(int length) {
if (length > 0) {
this.length = length;
return true;
}
else {
return false;
}
}
}

***IMPLEMENTATION CLASS BELOW HAS 3 BLOCKS OF CODE NEEDED. LOOK FOR THE COMMENTS LABELED "BLOCK"***

import javax.swing.JOptionPane;
public class TheatreIncomplete {
   public static void main(String[] args) {
      final int NUM_MOVIES = 5;
      Movie[] movies = new Movie[NUM_MOVIES];

      int x = 0;
      do {
      
         /** START: BLOCK #1
          * In the block below, enter code that will first check if there is room to enter another movie in the
          * movies array. If there is, call the add the movie to the array using the inputMovie() method.
          * Else, if there is not, display an error message to the user letting them know the maximum nubmer of movies
          * that can be entered.
          * Hint: To check the number of movies already entered, use the getNumMovies() static method
          */
         
         
         
         /** END: BLOCK #1 **/         

      }
      while (JOptionPane.showConfirmDialog(null, "Enter another movie?") == JOptionPane.YES_OPTION);

      Movie shortestMovie = getShortest(movies);
      printSummary(movies, shortestMovie);
   }

   private static Movie inputMovie() {
      Movie aMovie = new Movie();
      
      aMovie.setTitle(JOptionPane.showInputDialog(null, "Enter the title for movie " + Movie.getNumMovies() + ": "));
      
      int length;
      boolean isLengthSet = false;
      do {
         try {
            length = Integer.parseInt(JOptionPane.showInputDialog("Enter the length of " + aMovie.getTitle() + " in (minutes)"));
         }
         catch (NumberFormatException e) {
            length = -1;
         }
         isLengthSet = aMovie.setLength(length);
         if (!isLengthSet) {
            JOptionPane.showMessageDialog(null, "Sorry, you entered an invalid movie length. Please try again.");
         }
      } while(!isLengthSet);
      
      return aMovie;
   }
   
   private static Movie getShortest(Movie[] movies) {
      Movie aMovie = null;
      
      if (movies.length > 0) {
         
         /** START: BLOCK #2
          * In the block below, enter code that will find the movie object containing the shortest length
          * Hint: You will need to loop through all movies to find the shortest
          */
         
         
         
         /** END: BLOCK #2 **/
      }
      
      return aMovie;
   }
   
   private static void printSummary(Movie[] movies, Movie shortestMovie) {
      String summary="**Movie Summary**\n";
      
      /** START: BLOCK #3
       * First, using the summary variable declared above, loop through all of the movies entered, appending the title of each
       * movie to the summary. Then, append to the summary the number of movies entered, the title of the shortest movie
      * and the length of the shortest movie
       * Hint: To get the number of movies entered, use the getNumMovies() static method
       * Hint: To get the title and length of the shortest movie, use the object reference passed into the method
       */
      
              
      /** END: BLOCK #3 **/
              
      JOptionPane.showMessageDialog(null, summary);
   }
}

If you are not familiar with JOptionPane you can just code with Scanner and I will change it. Thank you.

In: Computer Science

What are the basic steps involved with creating a new thread? Why is it ok for...

  • What are the basic steps involved with creating a new thread?
  • Why is it ok for the OS to disable interrupts, but not application programs?

In: Computer Science

As you consider computer hardware and software, what hardware element do you think impact software performance...

As you consider computer hardware and software, what hardware element do you think impact software performance the most?

In: Computer Science

*Need to write the pseudocode for this given C++ code*: public:     slist(): head_(nullptr), size_(0) {}...

*Need to write the pseudocode for this given C++ code*:

public:
    slist(): head_(nullptr), size_(0) {}
    void prepend(int data)
    {
        snode* newnode = new snode(data, head_);
        head_ = newnode;
        ++size_;
    }
  
  
    bool empty() const
    {
        return size_ == 0;
    }
    size_t size() const{
        return size_;
    }
    friend std::ostream& operator <<(std::ostream& os, const slist sli){
        if(sli.empty()){
            return os << "list empty\n";
        }
        snode* p = sli.head_;
        while(p!= nullptr){
            os << *p << "\n";
            p=p->next_;
        }  
        return os;
    }
    int get_largest() const
    {
        snode*p = head_;
        int largest = p->data_;  
        while(p != nullptr){
            if (p->data_ > largest)
            {
                largest = p->data_;
            }
            p = p->next_;
        }
        return largest;
    }
  
    bool is_greater(int n){
        return is_greater_helper(head_,n);
    }
  
    bool is_greater_helper(snode* p ,int n){
        if(p->next_ == nullptr){return n > p->data_;}
        return n > p->data_ && is_greater_helper(p->next_, n);
    }
   

In: Computer Science

How is testing a software system like inspecting a house?

How is testing a software system like inspecting a house?

In: Computer Science

You were introduced to control structures - such as IF-ELSE statement, WHILE and FOR loops. Describe...

You were introduced to control structures - such as IF-ELSE statement, WHILE and FOR loops. Describe what they do and why are control structures important to programming?

In: Computer Science

mention some RFID anti-collision protocols ?

mention some RFID anti-collision protocols ?

In: Computer Science

3. To get some idea on what is involved in digital transmission of multimedia traffic, complete...

3. To get some idea on what is involved in digital transmission of multimedia traffic, complete the following:


3.1. In PAM encoding, the general rule is that we need to sample at twice the bandwidth. In addition, if we use n bits for each sample, we can represent 2n loudness (amplitude) levels. What transmission speed would you need if you wanted to encode and transmit, in real time and without compression, two-channel music with a bandwidth of 20 kHz and 40,000 loudness levels?

3.2. How much disk space would your require to store 30 minutes of digital music as you calculated above?


3.3. Assume that the 30 minutes of uncompressed digital music is to be transmitted over a DS-0 digital circuit at 64 Kbps. How long will it take to complete the transmission? Express you result in hours/minutes if necessary.

In: Computer Science

Please fill in the 20 blanks below: 1, Considering using sorted and unsorted array as priority...

  1. Please fill in the 20 blanks below:

1, Considering using sorted and unsorted array as priority queue to do sorting. For an input array, we insert each element to a PQ and remove them out to an output array. Please write the arrays below:

Input array: 2,7,5,3

  1. Sorted PQ after 1st Insertion:
  2. Sorted PQ after 2nd Insertion:
  3. Sorted PQ after 3rd Insertion:
  4. Sorted PQ after 4th Insertion:
  5. Output array after 1st removeMin:
  6. Output array after 2nd removeMin:
  7. Output array after 3rd removeMin:
  8. Output array after 4th removeMin:

Input array: 2,7,5,3

  1. Unsorted PQ after 1st Insertion:
  2. Unsorted PQ after 2nd Insertion:
  3. Unsorted PQ after 3rd Insertion:
  4. Unsorted PQ after 4th Insertion:
  5. Output array after 1st removeMin:
  6. Output array after 2nd removeMin:
  7. Output array after 3rd removeMin:
  8. Output array after 4th removeMin:

2, If I use upheap strategy to construct a heap(array as implementation) from above array, what is the array of the heap of each step?

  1. Step 1:
  2. Step 2:
  3. Step 3:
  4. Step 4:

In: Computer Science

How to fix this debugging in java Problem Debugging This problem is to assign a value...

How to fix this debugging in java

Problem Debugging

This problem is to assign a value to num2 based on the input value of num1. It should then print both numbers.

int num1 = 0;

int num2 = 0;

System.out.print("Enter a number - 1, 2, or 3: ");

num1 = keyboard.nextInt();

if (num1 == 1);

num2 = 2;

else if (num1 == 2);

num2 = 3;

else if (num1 == 3);

num2 = 4;

System.out.println("num1 = " + num1 // + " and num2 = " + num2);

System.out.println("\n");

In: Computer Science

Triangle Class write a class for triangle input is the length of the 3 edges you...

Triangle Class
write a class for triangle
input is the length of the 3 edges
you can use arccos: math.acos(you_input_here), the output is -pi to pi (in real value)

class math

class Triangle():
# initialize here
def __init__(xxx): # you need to modify this line
  
  
  
# your function angles is to output the 3 angles (in degree) in ascending order
def angles():
  
  
  
# is_equilateral outputs True if the triangle is equilateral
def is_equilateral():
  
  
  
# is_isosceles outputs True if the triangle is isosceles
def is_isosceles():
  
  
  
  
# if triangle A and B are similar, A.is_similar(B) returns True, False otherwise
def is_similar(xxx): # you need to modify this line

use python

In: Computer Science

Create your own function in C that accepts one input number and returns a double number....

Create your own function in C that accepts one input number and returns a double number. The themes for the functions should be one of the following:

Divides the number by 3 and returns the result. For example, if 6 was input then 2.0 should be returned.

provide both your C code and an example call to the C code function. Be sure to provide an overview of what your function is doing. Include header documentation in the code as well as internal code documentation.

In: Computer Science

Question 1: The Ethernet frame format has remained unchanged since the first standard; however, the cables...

Question 1:

The Ethernet frame format has remained unchanged since the first standard; however, the cables and the wiring scheme have changed dramatically.

A: True

B: False

Question 2:

The concept of a ___________ is allow a switch to be configured to emulate multiple, independent switches.

A. VLAN switch

B. Repeater

C. Modem

D. Bridge

Question 3:

A Virtual Local Area Network (VLAN) switch allows the switch to be reconfigured to emulate multiple, independent switches.

A. True

B. False

Question 4:

The IEEE 802.1Q standard allows

A. connections to multiple bridging devices on multiple LAN segments.

B. multiple VLAN switches to be interconnected and to operate like a giant VLAN switch.

C. a single switch to emulate multiple, independent switches.

D. switches to connect to a virtual WAN router.

Question 5:

The purpose of a Distributed Spanning Tree (DST) is to

A. include additional LAN segments on a network.

B. increase distances a message can be forwarded.

C. prevent broadcast messages from flowing in an endless loop.

D. associate a wireless host with an access point.

In: Computer Science