Questions
Describe the different types of firewalls that are on the market today and how they differ...

Describe the different types of firewalls that are on the market today and how they differ from one another. Please write two paragraphs on the matter and please explain properly.

In: Computer Science

Start NetBeans. Create a new project called Lab7. Create a Java main class file using the...

  1. Start NetBeans.
  2. Create a new project called Lab7.
  3. Create a Java main class file using the class name YourlastnameLab7 with your actual last name.
  4. Create a Java class file for a Polygon class.
  5. Implement the Polygon class.
    1. Add a private instance variable representing the number of sides in the polygon.
    1. Add a constructor that takes a single argument and uses it to initialize the number of sides. If the value of the argument is less than three, display an error message and exit the program.
    1. Add an accessor method for the number of sides.
    1. Override the toString method of the Object class to return a String containing the number of sides.

6. Add code to the main method of your main class to do the following:

    1. Create a Polygon object.
    1. Pass the object to System.out.println() to display it.

Run the program to make sure it works. The output should look something like this:

Testing Polygon constructor

Number of sides: 5

7. Create a Java class file for a RegularPolygon class.

8. Implement the RegularPolygon class.

    1. Modify the class header to make RegularPolygon a subclass of Polygon.
    1. Add a private instance variable to represent the length of a side (a double).
    1. Add a constructor that takes an int and a double and uses them to initialize the private instance variables. If the length of the side is less than or equal to zero, display an error message, and exit the program.
    1. Add an accessor method and a mutator method for the length of a side.
    1. Move the code from the constructor that does the input validation and initialization of the length of a side to the mutator method. Replace the constructor code you just moved with a call to the mutator.
    1. Add a method called getPerimeter that calculates the perimeter of the polygon. Remember that all of the sides of a regular polygon have the same length.
    1. Override the toString method from the Polygon class to include the side length and perimeter along with the number of sides. Use the toString method from the base class to construct the first part of the string.

9. Add code to the main method of your main class to do the following:

    1. Create a RegularPolygon object and display it.
    1. Call the side length mutator, and display the object again.

Run the program to make sure it works. The output should look something like this:

Testing Polygon constructor

Number of sides: 4

Testing RegularPolygon constructor

Number of sides: 5

Side length: 1.0

Perimeter: 5.0

Testing side length mutator

Number of sides: 5

Side length: 2.0

Perimeter: 10.0

10. Create a Java class file for a RegularTriangle class.

11. Implement the RegularTriangle class.

  1. Modify the class header to make RegularTriangle a subclass of

RegularPolygon.

    1. Add a private instance variable for the height of the triangle (a double).
    1. Add a constructor that takes a double representing the length of a side and uses the RegularPolygon constructor to initialize the number of sides and the side length. You do not need to initialize the height (you will see why in the next step.)
    1. Override the side length mutator so it calls the RegularPolygon mutator to initialize the side length, then sets the height to √3 × /2. This will take care of initializing the height since the constructor calls the RegularPolygon constructor, which calls this version of the side length mutator.
    1. Write an accessor method and a mutator method for the height. The mutator should display an error message and exit the program if the value provided is less than or equal to zero. It should also set the side length to 2 × ℎ      ℎ /√3.
    1. Write a method called getArea that calculates the area of the triangle using the formula = 1/2 × × ℎ      ℎ and returns it.
    1. Override the toString method to add information about the height and area.

12. Add code to the main method of your main class to do the following:

    1. Create a RegularTriangle object and display it.
    1. Call the height mutator, and display the object.
    1. Call the side length mutator, and display the object.

Run the program to make sure it works. The output should look something like this:

Testing Polygon constructor

Number of sides: 4

Testing RegularPolygon constructor

Number of sides: 5

Side length: 1.0

Perimeter: 5.0

Testing side length mutator

Number of sides: 5

Side length: 2.0

Perimeter: 10.0

Testing RegularTriangle constructor

Number of sides: 3

Side length: 4.0

Perimeter: 12.0

Height: 3.4641016151377544

Area: 6.928203230275509

Testing height mutator

Number of sides: 3

Side length: 3.464101615137755

Perimeter: 10.392304845413264

Height: 3.0

Area: 5.196152422706632

Testing side length mutator

Number of sides: 3

Side length: 4.0

Perimeter: 12.0

Height: 3.4641016151377544

Area: 6.928203230275509

In: Computer Science

Write a C++ program that will make changes in the list of strings by modifying its...

Write a C++ program that will make changes in the list of strings by modifying its last element.

Your program should have two functions:

1. To change the last element in the list in place. That means, without taking the last element from the list and inserting a new element with the new value.

2. To compare, you need also to write a second function that will change the last element in the list by removing it first, and inserting a new element with the new value.

The main creates the list, creates the string variables, populates few elements in the list (couple is enough) and calls the functions to modify the list. After each call to the functions, the main should print out the value of the last element in the list, so the changes are visible. Again, you print the last element not from within the functions, but from the main.

Note 1: You will need to use references to implement the in-place requirement.

Note 2: However difficult that assignment may look like, all information you need on how to work with the list is given to you in the lecture and both your functions implementation are just very few short statements (hint: If you find yourself writing 5 or more lines of codes for each function, you probably do it wrong).

Please Describe all variables and important sections of code.

Need a screenshot of the out put.

In: Computer Science

Discuss database constraints: Primary key, check, and referential integrity constraints? Give an example for each. What...

  1. Discuss database constraints: Primary key, check, and referential integrity constraints? Give an example for each.
  2. What are the three types of database design situations?
  3. Briefly describe the various tasks of the primary key. Explain the concept of a foreign key. Explain the concept of a surrogate key.
  4. Explain the essence of normalization that is implemented through the use of normal forms.
  5. What is SQL? Explain why it is important to learn SQL.
  6. What is the purpose of normalization? What conditions are required for a relation to be in 3NF?
  7. What are the advantages and disadvantages of normalization?
  8. Explain denormalization, and why it may be appropriate to denormalize a set of tables.

In: Computer Science

Can this code be rewritten but keeping the same functions as the original and with detailed...

Can this code be rewritten but keeping the same functions as the original and with detailed comments. I'm going to post the original homework lab just in case.

Attached to this assignment is a Java program that converts a text file to a list of hexadecimal numbers. Each of those hexidecimal numbers represents the bit pattern of a character from the file with the parity bits (even parity) for a hamming code inserted. Each text character takes 8 bits and the hamming code adds 4 bits. This hamming code provides single-bit error correction. Requirements 1. The program must be written in Java. If you have not used Java before, you can learn it enough to do this assignment, by looking at the provided program. 2. You can use Eclipse to write, compile and test your program, but you may also use any other development environment you like. Only the .java file will be submitted. 3. The program will use the provided Hamming class. It will implement the decode function. The decode function is the reverse of the encode function, but it also performs single bit correction when necessary. 4. Display a message to the console when an error is corrected, as in the example below. 5. The main function must be rewritten to read hexidecimal numbers from hamming.txt file and write decoded and corrected text to output.txt. 6. Test the program with different input files. The instructor will test it with a hamming.txt file different from the one provided.

import java.io.*;
import java.util.*;
public  class Hamming
        {
        private char letter;     
        private int[] bits = new int[12];
        private int code;         
        public Hamming(char let) { letter = let; encode(); }
        public Hamming(int c) { code = c; decode(); }
        public int getCode() { return code; }
        public char getLetter() { return letter; }

        private void encode() {
                int value = letter;
                        for (int i = 0; i < 12; i++) {
                        if (i != 0 && i != 1 && i != 3 && i != 7) {
                                bits[i] = value % 2;
                                value /= 2;
                        }
                }
                
                bits[0] = bits[2] ^ bits[4] ^ bits[6] ^ bits[8] ^ bits[10]; // ^ is XOR in Java
                bits[1] = bits[2] ^ bits[5] ^ bits[6] ^ bits[9] ^ bits[10];
                bits[3] = bits[4] ^ bits[5] ^ bits[6] ^ bits[11];
                bits[7] = bits[8] ^ bits[9] ^ bits[10] ^ bits[11];

                code = 0;
                for (int i = 11; i >= 0; i--) {
                        code *= 2;
                        code += bits[i];
                }
        }

        private void decode() {
                int error = 0;
                int value = code;


                for (int i = 0; i < 12; i++) {
                        bits[i] = value % 2;
                        value /= 2;
                }


                if (bits[0] != (bits[2] ^ bits[4] ^ bits[6] ^ bits[8] ^ bits[10])) error += 1; 
                if (bits[1] != (bits[2] ^ bits[5] ^ bits[6] ^ bits[9] ^ bits[10])) error += 2;
                if (bits[3] != (bits[4] ^ bits[5] ^ bits[6] ^ bits[11])) error += 4;
                if (bits[7] != (bits[8] ^ bits[9] ^ bits[10] ^ bits[11])) error += 8;
                

                if (error != 0)
                        bits[error - 1] ^= 1;


                letter = 0;
                for (int i = 11; i >= 0; i--) {
                        if (i != 0 && i != 1 && i != 3 && i != 7) {
                                letter *= 2;
                                letter += bits[i];
                        }
                }

                if (error != 0)
                        System.out.println("Error in bit " + (error - 1) + " corrected in character " + letter);
        }

        public static void main(String[] args) throws FileNotFoundException
        {
                Scanner  inFile = new Scanner( new File("hamming.txt"));
                PrintStream outFile = new PrintStream(new File("output.txt"));
                String line;
                int code;
                        
                System.out.println("File hamming.txt opened");  
                while (inFile.hasNextInt(16)) {
                                code = inFile.nextInt(16);
                        
                                
                
                                Hamming ham = new Hamming(code);
                                        

                                outFile.print(ham.getLetter()); 
                        
                        }
                inFile.close();
                System.out.println("File output.txt closed");
        }
}

In: Computer Science

C# ( asp.net ) 2019 visual studio I have a dropdown option. If I choose "date"...

C# ( asp.net ) 2019 visual studio

I have a dropdown option. If I choose "date" option, I get to enter list of dates like 02/08/1990, 06/14/1890 in (mm/dd/YYYY) format.

How can I sort these dates in ascending order?. Can you provide me some code. Thank you

In: Computer Science

Describe and discuss the main elements of the Entity-Relationship (E-R) model. Include an example. Briefly describe...

  1. Describe and discuss the main elements of the Entity-Relationship (E-R) model. Include an example.
  2. Briefly describe the process of converting an extended E-R model into a relational database design.
  3. How are one-to-many recursive relationships addressed using the relational model?
  4. Explain the representation of a one-to-many strong entity relationship in a relational database design.

In: Computer Science

Please answer these questions Data Processing and Analysis using python. Thank you Explain what does each...

Please answer these questions Data Processing and Analysis using python. Thank you

Explain what does each of the following functions do:

1. numpy.mean()

2. pandas.read_csv()

3. matplotlib.pyplot.plot()

In: Computer Science

// I can't get my cpp file to work with my header file and it always...

// I can't get my cpp file to work with my header file and it always says the error comes from compatibility I am using Visual Studio 2015 below is the error only my file path and program name has been erased. The issue comes up in my cpp file with the size_t empty and full functions.

// Error (active)       declaration is incompatible with "bool ListType::empty()" (declared at line 12 of ListType.h)        

// ListType header file

#ifndef ListType__h
#define ListType__h
#include
class ListType {
public:
   ListType();
   bool insert(int value);
   void eraseAll();
   void erase(int);
   bool find(int );
   size_t size();
   bool empty();
   bool full();
   const ListType & operator = (const ListType &other);
   friend std :: ostream & operator << (std :: ostream &out, const ListType &list);
protected:
   int list[100];
   size_t capacity;
   size_t count;
private:
};
#endif /* ListType__h */

//my cpp file

#include "ListType.h"
#include

ListType::ListType() {
   capacity = 100;
   count = 0;
}

bool ListType::insert(int value)
{
   bool result = false;
   if (!full()) {
       list[count] = value;
       ++count;
       result = true;

   }
   return result;
}

void ListType::eraseAll() {
   count = 0;
}
void ListType::erase(int value) {
   size_t i = 0;
   while (i < count&&value != list[i])++i;
   if (i < count) {
       list[i] = list[--count];
   }

}

bool ListType::find(int value) {
   bool result = false;
   if (!empty()) {
       size_t i = 0;
       while (i        result = (i    }
   return result;
}


size_t ListType::size() {
   return count;
}
size_t ListType::empty() {
   return count = 0;
}
size_t ListType::full() {
   return count == capacity;
}

const ListType& ListType:: operator=(const ListType& source) {
   if (this != &source) {
       count = source.count;
       for (size_t i = 0; i            list[i] = source.list[i];
       }
   }
   return *this;
}
std::ostream& operator<<(std::ostream &out, const ListType &other)

{

   out << "[ ";

   for (unsigned int i = 0;i

   {

       out << other.list[i] << " ";

   }

   out << "]";

   return out;

}

In: Computer Science

why do microwave antennas need line-of sight(los) communication. Rainfall affects both microwave communication and radio broiadcasting...

why do microwave antennas need line-of sight(los) communication. Rainfall affects both microwave communication and radio broiadcasting communication , which one will be more affected by rainfall?

In: Computer Science

Write a program in Java that reads in a set of positive integers and outputs how...

Write a program in Java that reads in a set of positive integers and outputs how many times a particular number appears in the list. You may assume that the data set has at most 100 numbers and -999 marks the end of the input data. The numbers must be output in increasing order. For example, for the data 15 40 28 62 95 15 28 13 62 65 48 95 65 62 65 95 95 -999

The output is

Number Count

13 1

15 2

28 2

40 1

48 1

62 3

65 3

95 4

In: Computer Science

Python Programming An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also...

Python Programming

An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also a prime. For example, 17 and 71 are prime numbers, so 17 and 71 are emirps. Write a program that displays the first 10 emirps.

In: Computer Science

C++ program that reads a positive integer number from a user and displays all binary numbers...

C++ program that reads a positive integer number from a user and displays all binary numbers from 0 to the number.

For the program, you can assume that the input number is a number between 0 and 100.

Sample Run 1: Assume that the user typed the following number.

5

This is the correct output of your program.

000

001

010

011

100

101

Sample Run 2: Assume that the user typed the following number.

0

This is the correct output of your program.

0

Sample Run 3: Assume that the user typed the following number.

3

This is the correct output of your program.

00

01

10

11

In: Computer Science

Creating Enumerations In this section, you create two enumerations that hold colors and car model types....

Creating Enumerations In this section, you create two enumerations that hold colors and car model types. You will use them as field types in a Car class and write a demonstration program that shows how the enumerations are used.

1. Open a new file in your text editor, and type the following Color enumeration: enum Color {BLACK, BLUE, GREEN, RED, WHITE, YELLOW};

2. Save the file as Color.java.

3. Open a new file in your text editor, and create the following Model enumeration: enum Model {SEDAN, CONVERTIBLE, MINIVAN};

4. Save the file as Model.java. Next, open a new file in your text editor, and start to define a Car class that holds three fields: a year, a model, and a color.

public class Car {

private int year;

private Model model;

private Color color;

5. Add a constructor for the Car class that accepts parameters that hold the values for year, model, and color as follows:

public Car(int yr, Model m, Color c) {

year = yr;

model = m;

color = c;

}

6. Add a display() method that displays a Car object’s data, then add a closing curly brace for the class.

public void display() {

System.out.println("Car is a " + year + " " + color + " " + model);

}

}

7. Save the file as Car.java.

8. Open a new file in your text editor, and write a short demonstration program that instantiates two Car objects and assigns values to them using enumeration values for the models and colors.

public class CarDemo {

public static void main(String[] args) {

Car firstCar = new Car(2014, Model.MINIVAN, Color.BLUE);

Car secondcar = new Car(2017, Model.CONVERTIBLE, Color.RED);

firstCar.display();

secondcar.display();

}

}

9. Save the file as CarDemo.java, and then compile and execute it.

the output should be something like

"Car is a 2014 BLUE MINIVAN

Car is a 2017 RED CONVERTIBLE"

in Java

In: Computer Science

Here is the problem I am working on. I need to write a py program that:...

Here is the problem I am working on. I need to write a py program that:

Calculates a Cartesian Product Output, A x B of 2 lists. I want to limit each list to 5 numbers. It is kind of working, but I can't help think that there is a simpler way to express this problem. Please advise...

Here is my code:

def CartesianProductOutput(A,B):

    lst = []

    for x in A:

        t = []

        t.append(x)

        for y in B:

            temp = []

            for x in t:

                temp.append(x)

            temp.append(y)

            lst.append(temp)

    return lst

A = [1,2,3,4,5]

B = [1,2,3,4,5]

print(CartesianProductOutput(A,B))

In: Computer Science