Questions
In this task you will implement a C++ function with arguments: a sorted integer array, size...

In this task you will implement a C++ function with arguments: a sorted integer array, size of the array, and a target integer value. Find all combinations of two elements in the sorted array which sum up to the target value. When found, add the combinations into an array, and print it. Where there is greater than one combination, you may use the number 200 as a separator for the combinations in the output array. Do not use more than one loop. Use pointer notation of arrays to do this question.

In: Computer Science

Consider the tables You may assume the corresponding columns have the same domains T1 D E...

Consider the tables You may assume the corresponding columns have the same domains

T1

D E F
10 a 5
15 b 8
15 c 4
25 a 6

T2

A B C
10 b 6
25 c 3
10 b 5

Show the results of each of the following relational algebra expressions in terms of table:

i. T1 ⋈ (D = A) T2

ii. T1⋈ (E=B) T2

iii. T1∪T2

iv. T1–T2

v. π (D,E)(T1) / π (B) (T2)

In: Computer Science

I. At the beginning, create a folder named "test" and add the folder into the version...

I. At the beginning, create a folder named "test" and add the folder into the version control tool tracking system. Then create one file named "001" under this folder. Commit any change if necessary.

II. Next, add another file named "002" in the same folder and commit the change ("adding") in the version control tool.

III. Followed by adding that file, create a branch (namely, "branch-A") in the version control tool and make some changes to the contents in file "001" under the newly created branch. Then commit the change from file "001".

IV. Create another branch (namely, "branch-B") from the main branch (NOT from "branch-A"!) in the version control tool and make some changes to the contents in file "002". Then commit the change from file "002".

V. The next step is to merge "branch-A" and "branch-B" and commit the change to the main branch. Record what you see from such an operation and make your own decision which version you want to keep.

VI. At last, Revise the current change from the merged result to the beginning where there was one file named "001". Record what you see from this operation.

(3) Show a graph of all version related operations from version control tool. The graph is used to visually depict how changes are made.

In: Computer Science

I keep get this exception error Exception in thread "main" java.lang.NullPointerException    at Quadrilateral.returnCoordsAsString(Quadrilateral.java:44)    at...

I keep get this exception error Exception in thread "main" java.lang.NullPointerException
   at Quadrilateral.returnCoordsAsString(Quadrilateral.java:44)
   at Quadrilateral.toString(Quadrilateral.java:51)
   at tester1.main(tester1.java:39)

In this program I needed to make a Point class to create a coordinate square from x and y. I also needed to make a Quadrilateral class that has an instance reference variable to Point

.The Quadrilateral class then inherits itself to other classes or in this case other shapes like square, trapazoid. I thought I did it right but for some reason there seems to be a problem with the toString class.

Here is Point class

public class Point {
private double x;
private double y;

public Point(double point1, double point2)
{
x = point1;
y = point2;
}
public Point()
{
x = 0.00;
y = 0.00;
}
public void setx(double x)
{
this.x = x;
}
public void sety(double y)
{
this.y = y;
}

public double getx()
{
return x;
}
public double gety()
{
return y;
}


@Override
public String toString()
{
return "(" + getx() + " , " + gety() + ")";
  
}
  
}

here is the Quadrilateral class

public class Quadrilateral {
Point Corner1;
Point Corner2;
Point Corner3;
Point Corner4;
public Quadrilateral(double x1, double y1, double x2, double y2, double x3, double y3 , double x4, double y4)
{
Point Corner1 = new Point(x1, y1);
Point Corner2 = new Point(x2, y2);
Point Corner3 = new Point(x3, y3);
Point Corner4 = new Point(x4, y4);
  
}

public Point getCorner1()
{
return Corner1;
}
public Point getCorner2()
{
return Corner2;
  
}
public Point getCorner3()
{
return Corner3;
}
public Point getCorner4()
{
return Corner4;
}
public String returnCoordsAsString()
{
String name1 = getCorner1().toString() + " , " + getCorner2().toString() + " , " + getCorner3().toString() + " , " + getCorner4().toString();
return name1;
}

@Override
public String toString()
{
String name = " coordinates od Quadrilateral are : " + returnCoordsAsString();
return name;

}

  
}

and this is the diver class

public class tester1 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Quadrilateral quadrilateral = new Quadrilateral(
1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4 );
quadrilateral.toString();
  
}
}

In: Computer Science

a) In no less than 100 words, describe several ways that an administrator could use the...

a) In no less than 100 words, describe several ways that an administrator could use the alias command to make their job easier.

b )In no less than 100 words, describe how you could use the "if" construct in administrating a Linux system.

c) Describe what stdout is? What is the default stdin? Describe stderr.

d) What file descriptor number represents stdout?

e) Describe redirection in BASH. Provide a command that uses redirection.

In: Computer Science

A) In your LAN, you want to allow the external host to communicate only with your...

A) In your LAN, you want to allow the external host to communicate only with your internal Telnet server (TCP / 23). External hosts are not allowed to establish TCP connection with other internal servers. Write the appropriate filtering rules for the security policy. [15 points]

Required fields for the filtering rule:

RuleID, SourceIP, DestIP, SourcePort, DestPort, Protocol, SYN, ACK, Action

B) Assume that the firewall in question A) is a stateless firewall. Give an example of a packet that will be accepted by this firewall, but the same packet would be rejected if the firewall was stateful. [5 points]

In: Computer Science

PYTHON: Write a function named is_palindrome() that returns boolean True if a word or phrase is...

PYTHON:

  1. Write a function named is_palindrome() that returns boolean True if a word or phrase is a palindrome, and boolean False if it is not.
  2. The palindromes for this problem are contained in the list below. You must use this list in your solution.
  3. Use a for loop to retrieve each palindrome and test it.

Your script should test each string in the list of palindromes below. Be aware there's a second list of palindromes embedded in the palindromes list. In other words, palindromes contains strings and it contains a list of strings. Your code should be able to detect whether the item is a list by using the isinstance() function.

Code to get you started

# YOUR COMMENT BLOCK GOES HERE
from random import shuffle

palindromes  = [  "Dennis, Nell, Edna, Leon, Nedra, Anita, Rolf, Nora, Alice, Carol, Leo, Jane, Reed, Dena, Dale, Basil, Rae, Penny, Lana, Dave, Denny, Lena, Ida, Bernadette, Ben, Ray, Lila, Nina, Jo, Ira, Mara, Sara, Mario, Jan, Ina, Lily, Arne, Bette, Dan, Reba, Diane, Lynn, Ed, Eva, Dana, Lynne, Pearl, Isabel, Ada, Ned, Dee, Rena, Joel, Lora, Cecil, Aaron, Flora, Tina, Arden, Noel, and Ellen sinned.", "Depardieu, go razz a rogue I draped.", "Desserts I stressed.", "Detartrated.", "Devo met a Mr., eh, DNA and her mate moved.", "Di as dad said.", "Did I draw Della too tall, Edward? I did?", "Dior droid.", "DNA-land.", "Do geese see god?", "Do good? I? No. Evil anon I deliver. I maim nine more hero-men in Saginaw, sanitary sword a-tuck, Carol, I. Lo! Rack, cut a drowsy rat in Aswan. I gas nine more hero-men in Miami. Reviled, I (Nona) live on. I do, O God.",'"Do nine men interpret?" "Nine men," I nod.', [ "abracadabra!","Mister, mister, on a see-saw with your sister.","Almost every sentence is NOT a palindrome! How unfair!"] ]

# Shuffle the palindromes
shuffle(palindromes)
   
#########
######### YOUR CODE GOES HERE
#########

In: Computer Science

Write a python program which asks the user to enter a positive number that is greater...

Write a python program which asks the user to enter a positive number that is greater than 30 called, “num2” and then does the following: o 1) Print all numbers between 1 and “num2” that are divisible by 2 and 3. o 2) Print all numbers between 1 and “num2” that are either divisible by 6 or 7. o 3) Print all numbers between 1 and “num3” that is not divisible by 5

In: Computer Science

a) Using vi (or from your favorite editor) create a file called myscript. Enter the following...

a) Using vi (or from your favorite editor) create a file called myscript. Enter the following text into the myscript file.

#!/bin/bash

echo -e "this is a sample shell script. \t It displays mounted filesystems \a"

mount

b) Now, save the file and quit the editor.

c) type ls -l myscript and hit enter. What permissions do you have on the file?

d) type bash myscript and hit enter. What did it do?

e) what does the \t and \a sequences do?

PART 2

a) Create your own BASH script that uses 3 different action

In: Computer Science

Write a Java program named BinaryConversion that will convert base 2 numbers to base 10 numbers....

Write a Java program named BinaryConversion that will convert base 2 numbers to base 10 numbers.

The data for this program will be entered from the keyboard using JOptionPane one 16-bit binary number at a time. Note that each base 2 number is actually read in as a String. The program should continue until a 16-bit base 2 number consisting of all 0’s is entered.

Once the 16-bit number has been entered your program should make sure that the input is valid, that is, make sure that it has 16 bits and make sure that there are no digits other than 0 and 1 in the input. If the input is invalid an appropriate message should be printed, the current, invalid, 16-bit base 2 number should not be converted, and your program should ask for a new 16-bit number.

Now that you’ve got a valid 16-bit base 2 number (remember that it’s actually a String) loop through the number to convert it to base 10. You must process each binary number digit by digit. No built-in conversion functions allowed.

Your program should print the output in a message dialog or the terminal window.

Sample input/output:

Enter a 16-bit binary number. 1111000011110000

Base 2: 1111000011110000

Base 10: 61680

enter a 16-bi binary number. 0000000000000000

Program Terminating

The proper use of loop and selection structures is the main focus of this assignment. Style and format making your program more readable is, as always, of considerable importance.

Test your program with several 16-bit base 2 numbers, to ensure that it is functioning correctly. You should also test your validation routine to make sure that it catches invalid input.

In: Computer Science

i keep getting return value ignored and and conversion from double to float , possible data...

i keep getting return value ignored and and conversion from double to float , possible data loss dont know how to fix the mistakes. if you could please fix it.

#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#include
#include


void O_Read_age_1()
{
   int sum = 0;
   int i;
   for (i = 1; i <= 2; i++)
   {

       int temp;
       printf("please enter the age of employee %d:", i);
       scanf("%d", &temp);
       sum += temp;
   }

   printf("\n");
   printf("The total age of all employees is%d\n", sum);
   return;
}
float O_Read_Salary_1()
{

   float sum = 0;
   int i;
   for (i = 1; i <= 2; i++)
   {
       printf("PLease enter the salary of the employee %d:", i);
       float temp;
       scanf("%f", &temp);
       for (; ((temp < 1000)) || ((temp > 6000));)
       {
           printf("Salary should be from 1000 to 6000:");
           scanf("%f", &temp);
       }
       if (temp <= 2150)
       {
           float inc = temp * 0.2;
           sum += temp;
           sum += inc;
       }
       else if ((temp > 2150) && (temp <= 4150))
       {

           float inc = temp * 0.15;
           sum += temp;
           sum += inc;
       }
       else if ((temp > 4150) && (temp <= 5150))
       {
           float inc = temp * 0.1;
           sum += temp;
           sum += inc;
       }
   }
   return sum;
}
void O_Read_Gender_1()
{
   int males = 0;
   int females = 0;
   int j = 0;
   char ch;
   for (j = 0; j < 2; j++)
   {
       printf("Enter the gender of employee %d (F or M):", j + 1);
       ch = getchar();
       scanf("%s",&ch);
       printf("\n");
       if (ch == 'F')
       {
           females++;
       }
       else if (ch == 'M')
       {
           males++;
       }
   }
   printf("The number of female employees is %d \n", females);
   printf("The number of male employees is %d \n", males);
  
   return;
}
void O_Calculate_Bonus_1()
{
   int bonus = 0;
   printf("Enter the rank of the company: %d");
   printf("\n");
   int Rank;
   scanf("%d", &Rank);
   printf("Enterr the ID of the company: ");
   int id;
   scanf("%d", &id);
   printf("\n");
   if (Rank == 1)
   {
       bonus = 15;
   }
   if (Rank == 2)
   {
       bonus = 10;
   }
   else
   {
       bonus = 5;
   }
   printf("Company ID = %d\n", id);
   printf("Rank= %d\n", Rank);
   printf("Bonus = %d", bonus);
   printf("Student: Bader Alostad Section:O1 ID:45191 - Semester Spring 2 online Press any button to continue...\n");
   return;
}


int main()
{
   float ans = O_Read_Salary_1();
   printf("\n");
   printf("The Function Read_Salary return the value %f \n", ans);
   O_Read_age_1();
   O_Read_Gender_1();
   O_Calculate_Bonus_1();
   return 0;

}

In: Computer Science

write a program in java that contain a class for botique . data member include code...

write a program in java that contain a class for botique . data member include code , color , size , quantity . your class should contains all accessor and mutator methods , non paraqmetric constructor , parametric constructor , input andvidsplay method

In: Computer Science

Which of the 5 AES modes satisfies COA (Ciphertext only attack)

Which of the 5 AES modes satisfies COA (Ciphertext only attack)

In: Computer Science

- In general, the occurrence of errors (errors) in a program can be classified in four...

- In general, the occurrence of errors (errors) in a program can be classified in four categories. List and explain, then give an example, of each mistake (error)!

and also

- It is known that: S -> aB | bA A -> a | aS | bAA B -> b | bS | aBB Derivation for the string aaabbabbba Provide a solution for its derivation and syntax analysis.

Please explain it with easy understandable method, because im still in learning phase :). Thanks in advance.

COURSE : Compilation Techniques

In: Computer Science

There is a particular situation in which Agile Development style is not suitable. You are required...

There is a particular situation in which Agile Development style is not suitable. You are required to just name that situation along with appropriate reasoning.

In: Computer Science