Questions
what is the motivation behind using a custom subnet mask versus a default subnet mask

what is the motivation behind using a custom subnet mask versus a default subnet mask

In: Computer Science

Use MySQL server. First step: create and use database called EDU. Syntax: CREATE SCHEMA edu; USE...

Use MySQL server.
First step: create and use database called EDU.
Syntax:
CREATE SCHEMA edu;
USE edu;

Create a script which will create the tables listed below:
STUDENT(STUDENT_ID, STUDENT_NAME, MAJOR_ID, DOB, PHONE_NUMBER)
MAJOR(MAJOR_ID, MAJOR_NAME)
ENROLLMENT(STUDENT_ID, COURSE_ID, GRADE)
COURSE(COURSE_ID, COURSE_NAME)
RESPONSIBILITY(FACULTY_ID, COURSE_ID)
TEACHER(FACULTY_ID, DEPT_ID, TEACHER_NAME)
DEPARTMENT(DEPT_ID, DEPARTMENT_NAME)

Start the script with a series of DROP statements so that as you correct mistakes you will start fresh each time. To avoid referential integrity errors, the table drops should be in the opposite order of the create table statements.

Put script name and your name in the script heading –see example:
Example of a script:
/*script1.sql
Student Name: ------*/
USE sh;
DROP TABLE IF EXISTS part;
DROP TABLE IF EXISTS salesrep;
CREATE TABLE part
(Partno    CHAR(4) PRIMARY KEY,
Partdesc VARCHAR(20),
Onhand    INTEGER,
Partclass CHAR(2) check (Partclass IN ('AP','HW','KI','SP')),
Unitprice DECIMAL(6,2)
);
CREATE TABLE salesrep
(Srepno     CHAR(3),
Srepname   VARCHAR(25),
Srepstreet VARCHAR(30),
Srepcity   VARCHAR(15) NOT NULL,
Srepprov   VARCHAR(3) NOT NULL,
Sreppcode VARCHAR(6) NOT NULL,
Totcomm    DECIMAL(8,2),
Commrate   DECIMAL(3,2),
CONSTRAINT pkslsrep PRIMARY KEY (Srepno)
);

In: Computer Science

Can you write a program for the card game WAR using linked lists in c++!

Can you write a program for the card game WAR using linked lists in c++!

In: Computer Science

Java Programming II Homework 2-1 In this assignment you are being asked to write some methods...

Java Programming II Homework 2-1 In this assignment you are being asked to write some methods that operate on an array of int values. You will code all the methods and use your main method to test your methods. Your class should be named Array Your class will have the following methods (click on the method signatures for the Javadoc description of the methods): [ https://bit.ly/2GZXGWK ]

public static int sum(int[] arr) public static int sum(int[] arr, int firstIndex, int lastIndex)

public static double average(int[] arr) public static double average(int[] arr, int firstIndex, int lastIndex)

public static int maxValue(int[] arr) public static int maxValue(int[] arr, int firstIndex, int lastIndex)

public static int indexOfFirstMaxValue(int[] arr)

public static int indexOfFirstMaxValue(int[] arr, int firstIndex, int lastIndex)

public static int numberOfBelowAverageElements(int[] arr)

public static int numberOfBelowAverageElements(int[] arr, int firstIndex, int lastIndex)

public static void rotateElements(int[] arr) public static void rotateElements(int[] arr, int rotationCount)

public static void reverseArray(int[] arr)

For example, given the following array: myArray = {45, 22, 18, 89, 82, 79, 15, 69, 100, 55, 48, 72, 16, 98, 57, 75, 44, 32, 21, 14, 7, 16, 49, 58, 72}

Your methods will return the following values:

1. Sum of whole array = 1253

2. Sum of elements 12-18 = 343

3. Average of whole array = 50.12

4. Average of elements 12-18 = 49.0

5. Max of whole array = 100

6. Max of elements 12-18 = 98

7. Index of first Max of whole array = 8

8. Index of first Max of elements 12-18 = 13

9. Count of elements below average of whole array = 13

10. Count of elements below average of elements 12-18 = 4 1

1. Rotating once myArray = {72, 45, 22, 18, 89, 82, 79, 15, 69, 100, 55, 48, 72, 16, 98, 57, 75, 44, 32, 21, 14, 7, 16, 49, 58}

12. Rotating 5 more times myArray = {14, 7, 16, 49, 58, 72, 45, 22, 18, 89, 82, 79, 15, 69, 100, 55, 48, 72, 16, 98, 57, 75, 44, 32, 21}

13. Reversing the array myArray = {21, 32, 44, 75, 57, 98, 16, 72, 48, 55, 100, 69, 15, 79, 82, 89, 18, 22, 45, 72, 58, 49, 16, 7, 14}

In: Computer Science

The United States Government has identified 16 critical infrastructure sectors whose assets, systems, and networks, whether...

The United States Government has identified 16 critical infrastructure sectors whose assets, systems, and networks, whether physical or virtual, are considered so vital to the United States that their incapacitation or destruction would have a debilitating effect on security, national economic security, national public health or safety, or any combination thereof. In a substantive post (at least 250 words or greater) identify those 16 critical infrastructures in an order of priority.

In: Computer Science

I am having problems making code to follow these parameters. 1. Create a new project and...

I am having problems making code to follow these parameters.

1. Create a new project and class in Eclipse. (5 points)

2. Add a comment with your name(s) on the first line of your code. (5 points)

3. Add the main method to the class. (5 points)

4. Use variables to store three book titles and their authors. (10 points)

5. Use variables to store the price of each book. (10 points)

6. Use variables to store the number of copies purchased of each book. (10 points)

7. Use a constant variable to store the tax rate (8.75%). (5 points)

8. Calculate the pretax total, sales tax, and total order cost using arithmetic operators and the variables described above. Store the calculation results in variables. (20 points)

9. Print the order information to the console. When printing dollar amounts, round each value to two decimal places (i.e., to the nearest penny). (20 points)

10. Use meaningful variable names, consistent indentation, and whitespace (blank lines and spaces) to make your code readable. Add comments where appropriate to explain the overall steps of your program. (10 points)

In: Computer Science

For this lab, you will write a C++ program that will calculate the matrix inverse of...

For this lab, you will write a C++ program that will calculate the matrix inverse of a matrix no bigger than 10x10. I will guarantee that the matrix will be invertible and that you will not have a divide by 0 problem.

For this program, you are required to use the modified Gaussian elimination algorithm. Your program should ask for the size (number of rows only) of a matrix. It will then read the matrix, calculate the inverse, and print the inverse, and quit. I do not care if you use two separate matrices one for the original and one for the inverse or if you combine the two. Note: the matrix should be a float, and you will need to use the cmath round function to get the output below.

Sample Run:

./a.out
input row size 3
input the matrix to invert
-1 2 -3
2 1 0
4 -2 5
the inverse is:
-5  4  -3  
10  -7  6  
8  -6  5

In: Computer Science

Explain in your own words what the precision (p) and scale (s) parameters for the Oracle...

Explain in your own words what the precision (p) and scale (s) parameters for the Oracle data type NUMBER mean.

In: Computer Science

A small grocery store uses a very basic file format to store prices for its goods....

A small grocery store uses a very basic file format to store prices for its goods. This file format has one item per line. The first word of the line is the name of the product, and after this is the price of the product in dollars (no dollar sign). For example, a typical file might look like:

bread 2.50

milk 1.90

pizza 10.95

Write a C program which reads one such file (create your own for testing) into two arrays, one called “items” which stores the product names, and the other called “prices” which stores all the prices. When creating the arrays, assume that the maximum length of a product name should be capped at 100 characters, and that there is a maximum of 1000 products in the file. Once all values are stored in the array, print the product list to the screen, including dollar signs in the prices as necessary along with headers for each column, for example:

ITEM PRICE

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

bread $2.50

milk $1.90

pizza $10.95

In: Computer Science

Draw and clearly explain the memory hierarchy, and illustrate the relevant memory hierarchy components on the...

Draw and clearly explain the memory hierarchy, and illustrate the relevant memory hierarchy components on the motherboard shown below. Then, compare “cache replacement policies” and ‘8-way set-associative cache mapping policies’ aspect of cache design in details in a computer with 4GB main memory and Quad-word memory configuration.

In: Computer Science

Consider the following string of page references: 5, 7, 8,9, 7, 3, 7, 4, 9, 3,...

Consider the following string of page references:
5, 7, 8,9, 7, 3, 7, 4, 9, 3, 7, 3, 9.
showing the frame allocation for:
a. Optimal
b. LRU (least recently used)
c. FIFO (first-in-first-out)
d. List the total number of page faults for each policy. Count page faults only after all frames
have been initialized.

In: Computer Science

I have a program to code for my computer science class, and Im not sure how...

I have a program to code for my computer science class, and Im not sure how to do it. If someone can explain it step by step I would appreciate it.

Problem Description:

Define the GeometricObject2D class that contains the properties color and filled and their appropriate getter and setter methods. This class also contains the dateCreated property and the getDateCreated() and toString() methods. The toString() method returns a string representation of the object.

Define the Rectangle2D class that extends the GeometricObject2D class and also contains:

  1. Two double data fields named x and y that specify the lower left corner of the rectangle with get

    methods.

  2. A data field width with a get method.

  3. A data field height with a get method.

  4. A no-arg constructor that creates a default rectangle with (0, 0) for (x, y), 1 for width and 1 for

    height.

  5. A constructor that creates a rectangle with the specified x, y, width and height.

  6. A method getArea() that returns the area of the rectangle.

  7. A method getPerimeter() that returns the perimeter of the rectangle.

  8. A method contains(double x, double y) that returns true if the specified point (x, y) is inside this

    rectangle. See Figure below.

  9. A method contains(Rectangle 2D rectangle) that returns true if the specified rectangle is inside

    this rectangle. See Figure.

  10. A method overlaps(Rectangle 2D rectangle) that returns true if the specified rectangle overlaps

    with this rectangle. See the figure below.

(a) (b) (c)

Figure

(a) A point is inside the rectangle. (b) A rectangle is inside another rectangle. (c) A rectangle overlaps another rectangle.

Draw the UML diagram for the class before implement the classes. Write a program that reads from the keyboard the lower left corner’s x and y coordinates, width and height of two rectangles. The program will then displays true if rectangle 1 contains rectangle 2 or false rectangle 1 does not contain rectangle 2.

Note: Run and make sure that your program produces exactly the same output for each of the sample inputs listed below.

Sample Input 1:

1 3.4 2 5
2 2.5 3 6

Sample Output 1: false

Sample Input 2:

1 1 6.1 7
2 323

Sample Output 2: true

Sample Input 3:

10 5 5 4.2
12 6.2 2 1.2

Sample Output 3: true

In: Computer Science

Using Java! Write a program that ask prompt the user to enter a dollar amount as...

Using Java!

Write a program that ask prompt the user to enter a dollar amount as double. Then, calculate how many quarters, dimes, nickels and pennies are in the dollar amount. For example: $2.56 = 10 quarters, 1 dime, 1 nickel and 1 cent. Print all of the values. Hint: Use Modulus operator and integer division when necessary.

In: Computer Science

the goal is for you to develop an approach that improves up on the array-based implementation...

the goal is for you to develop an approach that improves up on the array-based implementation in some way.For example, perhaps you want to take an approach that avoids the cost of re-allocating the array when it's full,e.g. using a linked-list. Of course, with a linked-list the cost of accessing an element will jump from O(1) to O(N), so that’s a costly trade-off. Perhaps you can think of a better approach that avoids the cost of reallocating the array, while retaining O(1) access to any element in most cases? In short, think of ways to break your myvector class, and write code to make sure your vector class works as required.

you are also required to add three additional functions to your myvector class, as defined below:

// // erase

// // erase the element at position i from the vector by overwriting it and

// reducing the size (# of elements); the ith element is returned //

// Assume: 0 <= i < Size // T erase(int i);

// // [] // // returns a reference to the element at position i so the element can

// be read or written //

// Assume: 0 <= i < Size //

T erase(int i);

T& operator[ ](int i);

// // [] //

// returns a reference to the element at position i so the element can

// be read or written //

// Assume: 0 <= i < Size

T* rangeof(int i, int j)

// // rangeof // // Returns the elements in the range of positions i..j, inclusive. // The elements are returned in a dynamically-allocated C-style array. // // Example: if i is 2 and j is 4, then an array containing 3 // elements is returned: element position 2, element position 3, and // element position 4. // // Assume: 0 <= i <= j < Size //

Do not add a destructor

use pointers in some way, above and beyond a single pointer to a dynamicallyallocated array. A simple one or two-way linked-list is a valid approach, but will not receive full credit.

Do not use any of the built-in containers of C++ (e.g. do not use std::vector to implement myvector)

main.cpp and function.cpp are read only function

myvector.h is a todo function

main.cpp

//
// Project #01: input movie review data from a file, and output moviename, # of
// reviews, average review, and # of reviews per star.
//
// File example "movie1.txt":
// Finding Nemo
// 5
// 4
// 5
// 4
// 5
// -1
//
// Output:
// Movie: Finding Nemo
// Num reviews: 5
// Avg review: 4.6
// 5 stars: 3
// 4 stars: 2
// 3 stars: 0
// 2 stars: 0
// 1 star: 0
//

#include <iostream>
#include <fstream>
#include <string>

#include "myvector.h"

using namespace std;

// functions from student.cpp:
myvector<int> InputData(string filename, string& moviename);
double GetAverage(myvector<int> reviews);
myvector<int> GetNumStars(myvector<int> reviews);

int main()
{
myvector<int> reviews;
myvector<int> numstars;
double avg;
string filename, moviename;

//
// 1. input filename and then the review data:
//
cin >> filename;

reviews = InputData(filename, moviename);

cout << "Movie: " << moviename << endl;
cout << "Num reviews: " << reviews.size() << endl;

//
// 2. average review
//
avg = GetAverage(reviews);
cout << "Avg review: " << avg << endl;

//
// 3. # of 5 stars, 4 stars, etc
//
numstars = GetNumStars(reviews);

for (int i = numstars.size(); i > 0; --i)
{
//
// i is 5, 4, 3, 2, 1:
//
if (i == 1)
cout << i << " star: " << numstars.at(i - 1) << endl;
else
cout << i << " stars: " << numstars.at(i - 1) << endl;
}

return 0;
}

functions.cpp

//
// Project #01: input movie review data from a file, and output moviename, # of
// reviews, average review, and # of reviews per star.
//

#include <iostream>
#include <fstream>
#include <string>

#include "myvector.h"

using namespace std;

//
// InputData
//
// Inputs the movie data from the given file, returning the moviename
// (via the parameter) and the individual reviews (via the returned
// vector). The reviews are ratings in the range 1..5.
//
// File format: the first line is the moviename. The name is followed
// by N > 0 reviews, one per line; each review is a value in the range
// 1-5. The last review is followed by a sentinel value (0 or negative)
// which is discarded.
//
// File example "movie1.txt":
// Finding Nemo
// 5
// 4
// 5
// 4
// 5
// -1
//
myvector<int> InputData(string filename, string& moviename)
{
myvector<int> V;
ifstream file(filename);
int x;

if (!file.good())
{
cout << "**Error: unable to open '" << filename << "'." << endl;
return V; // empty vector:
}

getline(file, moviename);

//
// input and store all reviews until sentinel is
// reached (0 or negative):
//
file >> x;

while (x > 0)
{
V.push_back(x);

file >> x; // next value:
}

// done, return vector of reviews:
return V;
}

//
// GetAverage
//
// Returns the average of the values in the vector; if the vector
// is empty then 0.0 is returned.
//
double GetAverage(myvector<int> V)
{
double sum = 0.0;
double avg;

for (int i = 0; i < V.size(); ++i)
{
sum += V.at(i);
}

if (V.size() == 0) // beware of divide-by-0:
avg = 0.0;
else
avg = sum / static_cast<double>(V.size());

return avg;
}

//
// GetNumStars
//
// Given a vector of reviews --- each review in the range 1-5 --- returns
// a vector of counts denoting the # of reviews of each rating. In other
// words, if we think of the reviews as "stars", the function returns a
// vector of 5 counts in this order: # of reviews of 1 star, # of reviews of
// 2 stars, ..., # of reviews of 5 stars.
//
// Example: suppose reviews contains the reviews 1, 5, 5, 2, 1, 4, 5. Then
// the function returns a vector containing 5 counts: 2, 1, 0, 1, 3.
//
myvector<int> GetNumStars(myvector<int> reviews)
{
myvector<int> numstars(5); // 1, 2, 3, 4, 5 stars

// let's make sure all the counts are initialized to 0:
for (int i = 0; i < numstars.size(); ++i)
{
numstars.at(i) = 0;
}

//
// for each review, increase count for that particular star (1-5):
//
for (int i = 0; i < reviews.size(); ++i)
{
int star = reviews.at(i); // 1-5:

numstars.at(star - 1)++; // index 0-4:
}

// return counts:
return numstars;
}

myvector.h

// Project #01: myvector class that mimics std::vector, but with my own
// implemenation outlined as follows:
//
// ???
//

#pragma once

#include <iostream> // print debugging
#include <cstdlib> // malloc, free

using namespace std;

template<typename T>
class myvector
{
private:
T* A;
int Size;
int Capacity;

public:
// default constructor:
myvector()
{
Size = 0;

Capacity = 1000;

A = new T[Capacity];
}

// constructor with initial size:
myvector(int initial_size)
{
Capacity = initial_size;

Size = initial_size;

A = new T[Capacity];
}

// copy constructor for parameter passing:
myvector(const myvector& other)
{
//
// we have to make a copy of the "other" vector, so...
//
A = new T[other.Capacity]; // allocate our own array of same capacity
Size = other.Size; // this vector is same size and capacity
Capacity = other.Capacity;

// make a copy of the elements into this vector:
for (int i = 0; i < Size; ++i)
A[i] = other.A[i];
}

int size()
{
//
//
//
return Size;
}

T& at(int i)
{
//
//
//
return A[i]; // this is WRONG, but compiles
}

void push_back(T value)
{
if (Size >= Capacity) {

int *temp = new int[2 * Capacity];

for (int i = 0; i < Size; i++)

temp[i] = A[i];

A = temp;

}

A[Size] = value;

Size++;
}

};

If you find better methods to improve the "myvector.h" you can try to update it but it still needs to be a template and I need it to have the erase, operator, and rangeof function in the file.

In: Computer Science

#include "pch.h" #include <iostream> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> int main() {        FILE...

#include "pch.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int main()
{
       FILE *fp;
       char c;

       errno_t err;
       err = 0;
       err = fopen_s(&fp,"Desktop/test.txt", "r"); file is on my desktop but I err=2 but I don't think it is opening the file?
       printf("%d\n", err);
       if (err == 2)
       {
           printf("The file was opened\n");
           while (1)
           {
               c = fgetc(fp) ?? Getting error when I try to read a file.;
               if (c == EOF)
               {
                   break;
               }
               printf("%c", c);
           }
       }
       else
       {
           printf("The file was not opened\n");

       }
       fclose(fp);

       return(0);
}

In: Computer Science