Questions
Write a method called "twoStacksAreEqual" that takes as parameters two stacks of integers and returns true...

Write a method called "twoStacksAreEqual" that takes as parameters two stacks of integers and returns true if the two stacks are equal and that returns false otherwise. To be considered equal, the two stacks would have to store the same sequence of integer values in the same order. Your method is to examine the two stacks but must return them to their original state before terminating. You may use one stack as auxiliary storage.

import java.util.Enumeration;

import java.util.LinkedList;

import java.util.Queue;

import java.util.Stack;

//Name,Class,Date..etc.. Header

public class Assignment6 {

public static void main(String[] args) {

//testSeeingThreeMethod();

//testTwoStacksAreEqualMethod();

//testIsMirrored();

}

public static void seeingThree(Stack<Integer> s) {

/*********Write Code Here************/

}

public static boolean twoStacksAreEqual(Stack<Integer> s1, Stack<Integer> s2)

{

/*********Write Code Here************/

}

public static boolean isMirrored(Queue<Integer> q) {

/*********Write Code Here************/

}

private static void testIsMirrored() {

Queue<Integer> myQueueP = new LinkedList<Integer>();;

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

{

System.out.print(i);

myQueueP.add(i);

}

for (int i = 3; i >= 0 ; i--)

{

System.out.print(i);

myQueueP.add(i);

}

System.out.println();

System.out.println(isMirrored(myQueueP) + " isMirrord");

}

private static void testTwoStacksAreEqualMethod() {

Stack<Integer> myStack1 = new Stack<Integer>();

Stack<Integer> myStack2 = new Stack<Integer>();

Stack<Integer> myStack3 = new Stack<Integer>();

Stack<Integer> myStack4 = new Stack<Integer>();

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

{

myStack1.push(i);

myStack2.push(i);

myStack4.push(i);

}

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

{

myStack3.push(i);

}

System.out.println(twoStacksAreEqual(myStack1,myStack2) + " Same Stack

");

System.out.println(twoStacksAreEqual(myStack3, myStack4) + " Not Same

Stack");

}

private static void testSeeingThreeMethod() {

Stack<Integer> myStack = new Stack<Integer>();

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

{

myStack.push(i);

}

System.out.println();

print(myStack);

seeingThree(myStack);

print(myStack);

}

private static void print(Stack<Integer> s) {

Enumeration<Integer> e = s.elements();

while ( e.hasMoreElements() )

System.out.print( e.nextElement() + " " );

System.out.println();

}

} //end of Assignment6

In: Computer Science

Description For this part of the assignment, you will create a Grid representing the pacman’s game...

Description For this part of the assignment, you will create a Grid representing the pacman’s game grid by using a 2D array of Strings as shown in Section 1. Also, you will design the functionality of the pacman as described in Section 2 and represent it in the grid. 1 The Grid The dimensions of the grid is 15 x 15 and the gird is composed of 4 boundaries: north, south, east, and west boundaries as shown in the Figure. The grid has the following characteristics: 1. The boundaries are represented with “X”, and this will block the pacman. 2. There may be obstacles that obstruct the pacman’s movement. 3. There are 4 gates represented with “ ”, and these gates communicates with the opposite gate. E.g., the north gate communicates with the south gate, and the east gate communicates with the west. This means that if the pacman is located in the north gate, next time it moves up will appear in the south gate, similar with the east and west gate. 4. The grid contains cookies represented with “.”. The idea is to collect all the cookies from the grid in order to win the game. Every time the the pacman eats a cookie, the cookie disappears. The Grid has the following fields • grid: is a 2D array of Strings • x-pos: the x-coordinate where the pacman is located • y-pos: the y-coordinate where the pacman is located • counter: a counter that represents the total number of cookies consumed by the pacman In addition, the Grid has the following methods: • initializeGrid(): This method will print a “fresh” new grid with the pacman located in the middle of the grid and the rest of the grid will contain cookies “.”. Except the boundaries of the grid. Your maze shall have four boundaries i.e., north, south, east, and west. The boundaries are represented with an “X”. Each boundary has a gate in the middle that allows the pacman to communicate to the opposite gate. • updateGrid(): will happen after the selection of moving “a”,“s”,“d” or “w” is done. Since these four options will move to west, south, east, or north, then you need to “update” the grid. The way to do this is by passing the x-coordinate and the y-coordinate as arguments to this method. The method then, will update the new position of the pacman (that is, the x and y coordinate from the arguments). Here is where the previous x and y position of the pacman will “disappear” (which is now a blank space “ ”). This method will reflect the new position of the pacman in the grid in case it moved. This method will also reflect the number of cookies consumed. • checkBoundaries(): Before moving the pacman to the new position, this method will check if is possible according the current coordinates. In case is a valid movement, the method will return true. In case the movement is invalid, due to a boundary or through something else, then your method will return false. The Pacman The pacman has the following characteristics: • The pacman has the ability to move through the gates (i.e., north to south, east to west). • The maze is full of cookies (e.g., “.”). The pacman must eat all the cookies to finish the game. Every time the pacman eats a cookie, it disappears from the maze the counter increases by 1. • If pacman movesUp by typing the key w, the pacman’s y-coordinate must increase by one unit. If the pacman’s y-coordinate exceeds the maze’s upper boundary, then the pacman’s y-coordinate AND the maze’s position shall not be updated. • If pacman movesDown by typing the key s, the pacman’s y-coordinate must decrease by one unit. If the pacman’s y-coordinate exceeds the maze’s lower boundary, then the pacman’s y-coordinate AND the maze’s position shall not be updated. • If pacman movesRight, by typing the key d, the pacman’s x-coordinate must increase by one unit. If the pacman’s x-coordinate exceeds the maze’s right boundary, then the pacman’s x-coordinate AND the maze’s position shall not be updated. • If pacman movesLeft, by typing the key a, the pacman’s x-coordinate must decrease by one unit. If the pacman’s x-coordinate exceeds the maze’s left boundary, then the pacman’s x-coordinate AND the maze’s position shall not be updated. Notice that by moving through the y-coordinate the program deals with the rows of the array, similar when dealing with the x-coordinate, the program deals with the columns of array. 3 The Game Engine In order to simulate a game, you must have an engine that keeps looping the position. This is exactly what happens in the old movie theater when they have the 35mm projectors. Here, we will simulate the same idea with a loop: 1. import java.util.Scanner; 2. public class Engine{ 3. public static void main(String [] args){ 4. String[][] grid = new String[10][10]; 5. int col = 5; 6. initializeGrid(grid); 7. grid[5][col] = "P"; 8. Scanner input = new Scanner(System.in); 9. while(true){ 10. print(grid); 11. String option = input.nextLine(); 12. if(option.equals("d")){ 13. // code goes here 14. } 15. // more code goes here 16. } 17. } 18. // methods go here 19. } In Line 4, will create a grid of 10 x 10 of Strings. In Line 7 will store the pacman (’P’) in the middle of the maze. In Line 9 will allow to run your program “forever” until you decide to finish your program. Line 11 will wait for the input from the user to move the pacman (i.e., “a”, “s”, “d”, or “w”). A complete engine can be found in Grid.java.

In: Computer Science

How does the RDBMS support Business Intelligence Applications?

How does the RDBMS support Business Intelligence Applications?

In: Computer Science

Describe a technique that can be used to break a columnar transposition cipher (besides brute force)?

Describe a technique that can be used to break a columnar transposition cipher (besides brute force)?

In: Computer Science

QUESTION 15 We need to write a function that calculates the power of x to n...

QUESTION 15

  1. We need to write a function that calculates the power of x to n e.g. power(5,3)=125.

    Which of the following is a right way to define power function?

    ______________________________________________________________

    int power(int a, int b)

    {

    int i=0, p=1;

    for(i=b;i>=1;i--)

      p*=a;

    return p;

    }

    ______________________________________________________________

    int power(int a, int b)

    {   

      int i=0, p=0;   

      for(i=1;i<=b;i--)       

        p=p*a;   

      return p;

    }

    ______________________________________________________________

    int power(int a, int b)

    {   

      int i=0, p=1;   

      for(i=b;i>=1;i--)       

        a*=p;   

      return p;

    }

    ______________________________________________________________

    int power(int a, int b)

    {   

      int i=0, p=1;   

      for(i=a;i>=1;i--)       

        p=p*b;   

      return p;

    }

    ______________________________________________________________

In: Computer Science

I can’t get my code to work and/or finish it. Please fix. Below are code instructions...

I can’t get my code to work and/or finish it. Please fix. Below are code instructions and then sample runs and lastly my code so far.
//*********************************************************************
Program
You will write a program that uses a recursive function to determine whether a string is a character unit palindrome. Moreover, flags can be used to indicate whether to do case sensitive comparisons and whether to ignore spaces. For example "A nut for a jar of tuna" is a palindrome if spaces are ignored and not otherwise. "Step on no pets" is a palindrome whether spaces are ignored or not, but is not a palindrome if it is case sensitive since the ‘S’ and ‘s’ are not the same.

Background
Palindromes are character sequences that read the same forward or backwards (e.g. the strings "mom" or "123 454 321"). Punctuation and spaces are frequently ignored so that phrases like "Dog, as a devil deified, lived as a god." are palindromes. Conversely, even if spaces are not ignored phrases like "Rats live on no evil star" are still palindromes. .

Specifications
Command Line Parameters
The program name will be followed by a list of strings. The program will determine whether each string is a palindrome and output the results. Punctuation will always be ignored. An optional flag can precede the terms that modifies how a palindrome is determined.

Strings
Each string will be separated by a space on the command line. If you want to include a string that has spaces in it (e.g. "Rats live on no evil star"), then put quotes around it. The quote characters will not be part of the string that is read in.

Flags
Optional for the user
If present, flags always appear immediately after the program name and before any strings are processed and apply to all subsequent strings processed.
Flags must start with a minus (-) sign followed by flag values that can be capital or lowercase. e.g. -c, -S, -Cs, -Sc, -alphabetsoup, etc.
There are no spaces between starting minus (-) sign and flag(s).
Flags values are case insensitive.
c or C: Indicates that comparisons should be case-sensitive for all input strings. The default condition (i.e. if the flag is NOT included) is to ignore case-sensitivity. So, for example:
palindrome Mom should evaluate as being a palindrome.
palindrome -c Mom should not evaluate as being a palindrome.
s or S: Indicates that comparisons should not ignore spaces for all input strings. The default condition (i.e. if the flag is NOT included) is to ignore spaces. So, for example:
palindrome "A nut for a jar of tuna" should evaluate as being a palindrome.
palindrome -s "A nut for a jar of tuna" should not evaluate as being a palindrome.
Any flag values beside c and s are invalid (see program flow notes below)
Options can appear in different flags, e.g. you can use -Sc or -S -c
Repeated flags should be ignored, e.g. -ccs
The argument -- (two dashes) signifies that every argument that follows is not a flag (allowing for strings that begin with a dash), e.g. palindrome -- -s

Code Expectations
Your program should only get user input from the command line. (i.e. "cin" should not be anywhere in your code).
Required Functions:
Function that prints program usage message in case no input strings were found at command line.
Name: printUsageInfo
Parameter(s): a string representing the name of the executable from the command line. (Not a c string)
Return: void.
Function that determines whether a string is a character-unit palindrome.
Name: isPalindrome
Parameter(s): an input string, a boolean flag that considers case-sensitivity when true, and a boolean flag that ignores spaces when true. (Not a c string)
Return: bool.
Calls helper function isPalindromeR to determine whether string is a palindrome.
String passed into isPalindromeR after dealing with flags.
If case insensitive, make all lower or upper case so that case does not matter.
If spaces are ignored, remove spaces from string.
Helper recursive function that determines whether a string is a character-unit palindrome. This does not deal with flags.
Name: isPalindromeR
Parameter(s): an input string (Not a c string)
Return: bool
All functions should be placed in a separate file following the code organization conventions we covered.

Program Flow
Your program will take arguments from the command-line.
Determine if you have enough arguments. If not, output a usage message and exit program.
If flags are present.
Process and set values to use when processing a palindrome.
Loop through remaining arguments which are all input strings:
Process each by calling isPalindrome function with flag values.
Output results

Program Flow Notes:
Any time you encounter a syntax error, you should print a usage message and exit the program immediately.
E.g. an invalid flag

Hints
Remember rules for a good recursive function.
Recommended Functions to write:
Note: You could combine these into a single function. e.g. "preprocessString"
tolower - convert each letter to lowercase version for case insensitive comparisons.
Parameter(s): a string to be converted to lowercase
Return: a string with all lowercase characters
removePunctuation - Remove all punctuation marks possibly including spaces depending on the flag value.
Parameter(s): a string and a boolean flag indicating whether to also remove spaces
Return: a string with punctuation/spaces removed
Existing functions that might help:
tolower
substr
isalnum
erase (This can be used instead of substr, but is a bit more complicated.)
Example Output
Assumes executable is named palindrome
$ g++ … -o palindrome …

./palindrome
Usage: ./palindrome [-c] [-s] string ...
-c: turn on case sensitivity
-s: turn off ignoring spaces

./palindrome -c
Usage: ./palindrome [-c] [-s] string ...
-c: turn on case sensitivity
-s: turn off ignoring spaces

./palindrome Kayak
"Kayak" is a palindrome.

./palindrome -c Kayak
"Kayak" is not a palindrome.

./palindrome -C Kayak
"Kayak" is not a palindrome.

./palindrome -c kayak
"kayak" is a palindrome.

./palindrome "Test Set"
"Test Set" is a palindrome.

./palindrome -sc "Test Set"
"Test Set" is not a palindrome.

./palindrome -s -c "Test Set"
"Test Set" is not a palindrome.

./palindrome -s -s "Test Set"
"Test Set" is not a palindrome.

./palindrome -scs "Test Set"
"Test Set" is not a palindrome.

./palindrome Kayak madam "Test Set" "Evil Olive" "test set" "loop pool"
"Kayak" is a palindrome.
"madam" is a palindrome.
"Test Set" is a palindrome.
"Evil Olive" is a palindrome.
"test set" is a palindrome.
"loop pool" is a palindrome.

#include <iostream>
#include <cctype>
#include <string>

using namespace std;

void printUsageInfo(string executableName) {
cout << "Usage: " << executableName << " [-c] [-s] string ... " << endl;
cout << " -c: turn on case sensitivity" << endl;
cout << " -s: turn off ignoring spaces" << endl;
exit(1);

//prints program usage message in case no strings were found at command line
}

bool isPalindrome(string str, bool caps, bool space) {

//determines whether a string is a character-unit palindrome
//should do everytyhing to find palindrome
return false;
}

bool isPalindromeR(string str, start, end) {
if (start >= end)
return true;

if(str.at(start) != str.at(end))
return false;
return isPalindromeR(str, ++start, --end);

//helper recursive function that determines whether string is a character-unit palindrome
}


string tolower(string str) {
for (unsigned int i = 0; i < str.length(); i++){
str.at(i) = tolower(str.at(i));
}
return str; //change to return string in all lowercase chars
}

string removePunctuation (string str, bool space) {
for(unsigned int i = 0; i < str.length(); i++){
if (ispunct(str.at(i))) {
str.erase(i);
cout << str;
}
}

return str;
//change to return string w/ punctuation/spaces removed
}
//****
int main(int argc, char* argv[]) {

bool caps = false;
bool space = true;
string executableName = argv[0];

if (argc < 2)
printUsageInfo(argv[0]);

int startIndex = 1;
int i = 1;

if ('-' == argv[1][0]) {
startIndex++;
while((argv[1][i]) != '\0') {
if ('c' == tolower(argv[1][i])){
caps = true;
}
else if ('s' == tolower(argv[1][i])) {
space = true;
}
else { //not a flag
printUsageInfo(argv[0]);
break;
}
i++;
}//while
//cout << space << endl;
//cout << caps << endl;
} //if

else {

}

//TO DO

for(int j = startIndex; j < argc; ++j) {
if (caps) {
cout << tolower(argv[j]);
}
else if (space) {
cout << removePunctuation(argv[j], space);
}
else if (caps && space){
cout << "seriously, fix me";
}
else {
cout << "else";
}
}
cout << endl;

//isPalindrome(cup, bool caps, bool space);
cout << "end of program" << endl;
return 0;
}


In: Computer Science

1b. Explain each of the following with an example in two languages of your choice for...

1b. Explain each of the following with an example in two languages of your choice for each item. (25 points)

  • Orthogonality

  • Generality

  • Uniformity

In: Computer Science

Assignment # 6: Chain of Custody Roles and Requirements Learning Objectives and Outcomes Describe the requirements...

Assignment # 6: Chain of Custody Roles and Requirements

Learning Objectives and Outcomes

  • Describe the requirements of a chain of custody.
  • Differentiate the roles of people involved in evidence seizure and handling.

Assignment Requirements

You are a digital forensics intern at Azorian Computer Forensics, a privately owned forensics investigations and data recovery firm in the Denver, Colorado area. Azorian has been called to a client’s site to work on a security incident involving five laptop computers. You are assisting Pat, one of Azorian's lead investigators. Pat is working with the client's IT security staff team leader, Marta, and an IT staff member, Suhkrit, to seize and process the five computers. Marta is overseeing the process, whereas Suhkrit is directly involved in handling the computers.

The computers must be removed from the employees' work areas and moved to a secure location within the client's premises. From there, you will assist Pat in preparing the computers for transporting them to the Azorian facility.

BACKGROUND

Chain of Custody

Evidence is always in the custody of someone or in secure storage. The chain of custody form documents who has the evidence in their possession at any given time. Whenever evidence is transferred from one person to another or one place to another, the chain of custody must be updated.

A chain of custody document shows:

  • What was collected (description, serial numbers, and so on)
  • Who obtained the evidence
  • Where and when it was obtained
  • Who secured it
  • Who had control or possession of it

The chain of custody requires that every transfer of evidence be provable that nobody else could have accessed that evidence. It is best to keep the number of transfers as low as possible.

Chain of Custody Form

Fields in a chain of custody form may include the following:

  • Case
  • Reason of evidence obtained
  • Name
  • Title
  • Address from person received
  • Location obtained from
  • Date/time obtained
  • Item number
  • Quantity
  • Description

For each evidence item, include the following information:

  • Item number
  • Date
  • Released by (signature, name, title)
  • Received by (signature, name, title)
  • Purpose of chain of custody

For this assignment:

  1. Walk through the process of removal of computers from employees’ work areas to the client's secure location and eventually to the Azorian facility. Who might have possession of the computers during each step? Sketch a rough diagram or flow chart of the process.
  2. Each transfer of possession requires chain of custody documentation. Each transfer requires a signature from the person releasing the evidence and the person receiving the evidence. Include the from/to information in your diagram or flow chart.

In: Computer Science

Write the code for binary min heap in c++ .

Write the code for binary min heap in c++ .

In: Computer Science

write a C program to display the dimensions of a room along with number of doors...

write a C program to display the dimensions of a room along with number of doors and number of windows. make it user prompt including a function.

In: Computer Science

Consider a company which owns a license of Class C network (207.84.123.0), This Company wants to...

Consider a company which owns a license of Class C network (207.84.123.0), This Company wants to create 14 subnetworks.
1.
Determine the number of bits borrowed
2.
How many bits are then used for the subnet ID?
Determine the maximum number of hosts in each subnet
3.
Determine the subnet mask of this scheme
4.
Determine the first, the forth and the last network (subnet) addresses
5.
Determine the first host address, the last host address and the broadcast address in only the first subnet.
6.
7. To which subnet belongs the host having the address 207.84.123.181?

In: Computer Science

Suggest with proper explanation 10 reasons about which web framework is likely to at the forefront...

Suggest with proper explanation 10 reasons about which web framework is likely to at the forefront of technology in the next decades.

NOTE: NO plagiarism from the internet it should be typed in your OWN WORDS PLEASE.

In: Computer Science

The company decided to hire you to be its new Director of Information Security. Explain ten...

The company decided to hire you to be its new Director of Information Security.

  1. Explain ten security policies, procedures, and/or technologies you would put into place during your first year on the job. For each strategy, you must explain one type of security problem that the strategy would attempt to prevent. The security problem does not have to be from the list provided above.
  2. list six things that should be included in a disaster recovery plan for The Insurance Company

In: Computer Science

i want three research question in PICOC model on the following key topics Key Concepts: Optimization...

i want three research question in PICOC model on the following key topics

Key Concepts: Optimization Techniques, Resource Scheduling, Scheduling Algorithms, Cloud Computing, Scheduling Strategies, Cloud Security

General Topic: Resource Scheduling in cloud computing

Who: Small scale industries

What: scheduling algorithms

When: current situation

Where: Software Industries


In: Computer Science

A) Based on what the Federal Information Processing Standard 199 (FIPS-199) requires information owners to classify...

A) Based on what the Federal Information Processing Standard 199 (FIPS-199) requires information owners to classify information and information systems? Provide a detailed answer.

B) Are there any differences between classifying governmental information and commercial information? And are there any common levels of classification have been used to classify governmental information and commercial information? Explain your answers and supported them with examples (NOT from the book or slides).

C) Can a company make a change on classified information? Assuming now a company feels that such information need higher protection or the company decide to make some information that was classified as secret to be accessed by public. Here, is there any mechanism or process that allows a change in classified information. Explain your answers and supported them with examples (NOT from the book or slides).

In: Computer Science