Questions
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

Part 2: You are investigating the electrical testing circuits and find that, in an inductive circuit,...

Part 2:

  1. You are investigating the electrical testing circuits and find that, in an inductive circuit, the relationship between instantaneous current i (amps) and the time t (secs) is given by:

i = 2.1(1-e-9t)

You have been asked to determine the time taken for the current to rise from 1 to 1.5 amps.

Comment on the time taken for the current to rise the same increment from 1.5 to 2 amps and give reasons. You are not required to evaluate this.

  1. The drive system of a conveyor used to transport the engine parts is made up of an open belt which passes over two pulleys. The pulleys have diameters of 200mm and 320mm respectively and the distance between centres is 600 mm.

You have been asked to determine the length of the belt, using trigonometric techniques, assuming the belt is in tension.

  1. An electrical cable is to be suspended across two machines. The machines are a distance of 4.5 metres apart. The cable takes the shape of a catenary of the form y = c cosh (x/ where x is the horizontal distance of any given point on the catenary from its centre and y is it’s height from the ground surface. You have been asked to determine the fixing point height (y) if the minimum clearance (c) is to be 3m at the centre of the catenary.

In: Math

I have been given a final year project to develop a model for ‘Spare part inventory...

I have been given a final year project to develop a model for ‘Spare part inventory control and management’ for multinational company. the model should include the best suitable classification method and a simple mathematical approach for forecasts. Suggest me the best approach to accomplish this. I am expecting,

  1. Explanation in developing the model step by step.
  2. Suitable classification method for spare parts.
  3. A simple mathematical approach for forecasting spare parts (preferably with an example).
  4. Other key factors to be concerned in developing the model.
  5. Good referencing documents or sites for more accurate information.

Help me to develop the model with a limited time frame due to heavy workload. Thanks

In: Operations Management

Consider a plane wave of monochromatic green light, ? = 500 nm, that is incident normally...

Consider a plane wave of monochromatic green light, ? = 500 nm, that is incident normally upon two identical narrow slits (the widths of the individual slits are much less than ?). The slits are separated by a distance d = 30 µm. An interference pattern is observed on a screen located a distance L away from the slits. On the screen, the location nearest the central maximum where the intensity is zero (i.e., the first dark fringe) is found to be 1.5 cm from this central point. Let this particular position on the screen be referred to as P1.
(a) Calculate the distance, L, to the screen. Show all work.

(b) calculate the ditance between the first and second dark bands in the interference pattern. Shown all work.

(c)In each of the parts below, one change has been made to the problem above (in each case, all parameters not explicitly mentioned have the value or characteristics stated above). For each case, explain briefly whether the light intensity at location P1 would remain zero or not. If not, will P1 become the location of a maximum constructive interference (bright) fringe? In each case, explain your reasoning.

1) One of the two slits is made slightly narrower, so that the amount of light passing through it is less than that through the other.

2) The wavelength is doubled so that ? = 1000 nm.

3) The two slits are replaced by a single slit whose width is exactly 60 µm.

In: Physics

1.On a spacecraft, two engines are turned on for 542 s at a moment when the...

1.On a spacecraft, two engines are turned on for 542 s at a moment when the velocity of the craft has x and y components of v0x = 2960 m/s and v0y = 5010 m/s. While the engines are firing, the craft undergoes a displacement that has components of x = 3.31 x 106 m and y = 4.76 x 106 m. Find the (a) x and (b) y components of the craft's acceleration.

2.A horizontal rifle is fired at a bull's-eye. The muzzle speed of the bullet is 690 m/s. The gun is pointed directly at the center of the bull's-eye, but the bullet strikes the target 0.028 m below the center. What is the horizontal distance between the end of the rifle and the bull's-eye?

3.A golf ball rolls off a horizontal cliff with an initial speed of 14.0 m/s. The ball falls a vertical distance of 12.7 m into a lake below.(a) How much time does the ball spend in the air? (b) What is the speed v of the ball just before it strikes the water?

4.A rocket is fired at a speed of 85.0 m/s from ground level, at an angle of 38.0

In: Physics

Oil Well Supply offers a 7 percent coupon bond with semiannual payments and a yield to...

Oil Well Supply offers a 7 percent coupon bond with semiannual payments and a yield to maturity of 7.73 percent. The bonds mature in 9 years. What is the market price per bond if the face value is $1,000?

$1,401.26

$1,016.95

$1,401.86

$953.88

$953.28

In: Finance

From load analysis, the following are the factored design forces result: Mu = 440 KN-m, Vu...

From load analysis, the following are the factored design forces result: Mu = 440 KN-m, Vu = 280 KN. The beam has a width of 400 mm and a total depth of 500 mm. Use f’c = 20.7 MPa, fy for shear reinforcement is 275 MPa, fy for main bars is 415 MPa, concrete cover to the centroid of the bars both in tension and compression is 65 mm, steel ratio at balanced condition is 0.02, lateral ties are 12 mm diameter. Normal weight concrete.

A. Determine the required spacing of transverse reinforcement due to the factored shear in mm

B. Calculate the required area of tension reinforcement in mm2 due to the factored moment, Mu

C. Calculate the required area of compression reinforcement in mm2 due to the factored moment, Mu

In: Mechanical Engineering

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

Think about your place of work, your household or your school. Then, come up with 2...

Think about your place of work, your household or your school. Then, come up with 2 examples of efficiency (i.e, what you/they do well) and explain why you consider it efficient, AND 2 examples of inefficiency (i.e, what you/they do NOT do as well as you are capable of) and explain why it is inefficient. For the inefficiency, explain how you would solve each of those problems (correct the inefficiencies). When you reply to others, offer suggestions, input and advice - maybe you experienced something similar.

In: Economics

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

Your neighbor tells you that her nine-year-old son has been having behavior and academic problems in...

Your neighbor tells you that her nine-year-old son has been having behavior and academic problems in school. “His teacher recommended taking him to the pediatrician to get a prescription for Ritalin,” she said.

Make an argument for why your neighbor should first have her son evaluated by a clinical psychologist. Discuss the types of assessment tools the psychologist might use in his or her evaluation and how these tools would help in guiding diagnosis and treatment.

In: Psychology

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

Three entrepreneurs plan to open a copy shop. It costs $5000 per year to rent a...

Three entrepreneurs plan to open a copy shop. It costs $5000 per year to rent a copier. It costs $0.03 per copy to operate the copier. Other fixed costs of running the store will amount to $400 per month. The planned price per copy is $0.10. The shop will be open 365 days per year. Each copier can make up to 100,000 copies per year.

SHOW THE FOLLOWING IN EXCEL( show the formulas and calculation)within excel !!!  THANK YOU SO SO MUCH!

  1. Use Goal Seek feature to determine annual break-even point for the use of three rented copiers by changing (1) copy units, (2) unit pricing, (3) per variable costs, and (4) fixed costs.

In: Operations Management

I understand how electrons initially move into another's vicinity, but nowhere can I find a fathomable...

I understand how electrons initially move into another's vicinity, but nowhere can I find a fathomable answer to this. Also, does the pairs forming 'a condensate' mean a Bose-Einstein condensate?

In: Physics