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 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?
In: Computer Science
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 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
In: Computer Science
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
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:
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:
For each evidence item, include the following information:
For this assignment:
In: Computer Science
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 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 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 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.
In: Computer Science
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 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