Home » 1)Declare An Integer Variable Named Angle Assign The Value 22 To The Variable Named

1)Declare An Integer Variable Named Angle Assign The Value 22 To The Variable Named

1)Declare an integer variable named angle Assign the value 22 to the variable named angle call/invoke the turn method and use angle as the argument/parameter 2)which of the following is correct if you want to call a public static method named rotate with the following method signature: public void rotate() from a class named Plane you don’t inherit from Group of answer choices rotate(); Plane(); Plane.rotate(); Plane.rotate() 3)create a character variable named letter write an if statement to that tests if a Greenfoot object is at the end of the screen and if letter is equal to ‘$’

1. Randomly Generate 1,000 Pets, From The Choices “dog,” “cat,” “hamster,” And “goldfish,” With
1. Randomly generate 1,000 pets, from the choices “dog,” “cat,” “hamster,” and “goldfish,” with equal probability of each being chosen. Display the first few values of the resultant variable, and count the number of each type of pet. Here is an example of a statement using sample gender_char <- factor(sample( c(" female", "male"), 10000, replace = TRUE)) summary(gender_char) Please help with this! Note: you will want to use the factor function in order to be able to get the summary. Q2. Complete The Following Program Such That It Shifts All The Elements In The Transcribed Image Text from this QuestionQ2. Complete the following program such that it shifts all the elements in the array to the left by ‘k’ slots and fill the last ‘k’ slots by -1. The value of ‘k’ is given by the user and must be less than 9. You cannot use any other array for this problem. Print the array to check if your program is working correctly. Sample examples given below. LE Sample examples: Input array: (0) (1) 11 22 [2] 33 [3] 88 [4] 44 (5) 16 [6] [8] 100 (9) 77 1 99 If k = 2 the array values becomes: [0] 0 [2] [3] 33 88 44 16 [4] 1 (5) 99 [6] 100 [7] 77 18 -1 [9] -1 If k = 7 the array values becomes: TO JU [2] (3) 99 100 77 -1 141 -1 (5) -1 161 -1 18] -1 191 -1 Tasks Task1: Write A Program That Processes A Data File Of Names In Which Transcribed Image Text from this QuestionTasks Task1: Write a program that processes a data file of names in which each name is on a separate line of at most 80 characters. Here are two sample names: Hartman-Montgomery, Jane R. Doe, J. D. On each line the surname is followed by a comma and space. Next comes the first name or initial, then a space and the middle initial. Your program should scan the names into three arrays-surname, first, and middle_init. If the surname is longer than 15 characters, store only the first 15. Similarly, limit the first name to ten characters. Do not store periods in the first and middle_init arrays. Write the array’s contents to a file, aligning the contents of each column: a Hartman-Montgom Doe Jane J R D Mohammad – Awad, Qassam H. Raji-Abdallah, R. S. Fayez, Eman H. Taher-Abu-Alrob, Hammam H. Hamadeh, Ahmad E. Abd-Alqader-Shelbaya, S. H. Karmi, Habeeb B. Ahmad-Alamleh, Y. M. Zayed, Eddy Z. Mahmoud-Zayed-Tawil, M. M. Mohammad-Abdalkareem, Sajed K. Hamad, Khalid R. Nawahdah, Mamoun Ismael A. H S H H E H Mohammad – Awad Raji-Abdallah Fayez Taher-Abu-Alrob Hamadeh Abd-Alqader-She Karmi Ahmad – Alamleh Zayed Mahmoud-Zayed-T Mohammad – Abdalk Hamad Nawahdah Qassam R Eman Hammam Ahmad S Habeeb Y Eddy M Sajed Khalid Mamoun Isma M Z M K R A Explanation: The Above Body.txt And Data.txt Files Should Generate M=2 Files (one Each For Computer Science Assignment Writing ServiceTranscribed Image Text from this QuestionDocument1 – Word (Product Activation Failed) File Home Insert Design Layout References Mailings Review View Tell me what you want to do… Given The Following Table, Estimate The Value Of Y(0.625) Using Second-order Newton Divided-Difference Polynomial Transcribed Image Text from this QuestionGiven the following table, estimate the value of y(0.625) using Second-order Newton Divided-Difference Polynomial x = 0.00000 0.25000 0.50000 0.75000 1.00000 1.25000 y = 25.000 18.064 14.653 16.055 22.957 35.918 Given the following table, estimate the value of y(1.875) using Second-Order Newton Divided-Difference Polynomial 0.00000 0.75000 150000 2.25000 3.00000 3.75000 25.000 16.055 55.732 171.156 430.573 987.958 Q2) (32 Points) A Database Has The Following Operations Table And This Table Contains Transcribed Image Text from this QuestionQ2) (32 points) A database has the following operations table and this table contains two rows: operations op_id amount 1000 2 500 1 Two concurrent separate transactions try to work on this database. The details of these transactions are given below. To simulate the time consuming commands, sleep(x) is used in transactions for x seconds waiting. You may assume all other commands are executed below 100 ms. Linet Transaction 1 Lined 1 1 SET TRANSACTION ISOLATION LEVEL X Transaction 2 SET TRANSACTION ISOLATION LEVEL X 2 BEGIN TRANSACTION 2 BEGIN TRANSACTION 3 sleep (2) SELECT SUM(tutar) FROM islemler 4 INSERT islemler (islem_no, tutar) VALUES (3, 5000) sleep (5) 5 SELECT SUM(tutar) FROM islemler 5 sleep (5) 6 6 sleep (5) UPDATE islemler SET tutar = tutar 2 WHERE islem_no-1 sleep (5) 7 SELECT SUM(tutar) FROM islemler 7 8 COMMIT 8 COMMIT 9 sleep (10) 10 SELECT SUM(tutar) FROM islemler For each different transaction isolation level (X), fill in the following table assuming these two transactions start simultaneously. For deadlock situations, write DL. х Output of select in line 3 sum(tutar) For transaction 2 Output of select Output of select in line 5 in line 7 sum(tutar) sum(tutar) Output of select in line 10 sum(tutar) Serializable sum(tutar) sum(tutar) sum(tutar) sum(tutar) Repeatable Read sum(tutar) sum(tutar) sum(tutar) sum(tutar) Read Committed sum(tutar) sum(tutar) sum(tutar) sum(tutar) Read Uncommitted Solving Mazes Using Stacks And Queues Write A Maze Solving Program, With The Following Transcribed Image Text from this QuestionSolving Mazes Using Stacks and Queues Write a maze solving program, with the following functionality, exactly as specified. Note that further advice and implementation details are provided at the end of this document. App menu: The program prints to the console a menu presenting the user with the 8 options described hereafter. It performs whichever operation is selected by the user, prints the results and other appropriate output accordingly, then prints the menu again – until Quit is chosen. 1. Load maze: The program reads a maze layout from a plain text file and loads it into an appropriate data structure. If successful, it displays the maze, as depicted hereafter in option #2. Otherwise, it prints some explicit error message e.g., “error: file not found”. Sample code to read a maze from a text file is provided in appendix. 2. Display maze: The program prints to the console the currently loaded maze. If start and/or goal locations are defined, it displays them as well, as illustrated in options #3-4. If no maze is loaded, it prints an error message e.g., “error: no maze available.” — — — — — – — — — — — – 1 — — – — — — — – – — — — 3. Set start: The program prompts the user for X-Y coordinates i.e., two integers, and reads in the user input. If the given coordinates are valid, based on the width and height of the maze, it prints to the console the current maze with the start location indicated with the “S” symbol, as 7. Display path: The program prints to the console the maze and the last path found, as illustrated below. Cells on the path are shown with the ‘@’ symbol, while cells visited by DFS/BFS but not on the path are shown with the “*” symbol, and unvisited cells are left blank. If there is no maze or no path, it prints an appropriate error message. A sample output is shown below where, in this particular case, DFS backed out of dead ends twice before following the path to the goal. — SI 1 I @1 — — — I @ @ @ @ @ 1 — – I @ @ @ @1 — — — @ G — — — — — 8. Quit: The program prints some “goodbye” message to the console and terminates. illustrated hereafter. If any of the X or Y coordinates is invalid, it prints an appropriate error message e.g., “error: X coordinate cannot exceed the width of the maze”. — – — — — — — — — SI — — 1 SI — — 1 – – – – – – — — — — — — – — – — — — — – 1 1 1 1 1 — – — — — — 1 — — G – — — — — — — 4. Set goal: Similarly to the above, the program prompts the user for two X-Y coordinates and reads in the input. If coordinates are valid, it prints to the console the current maze with the goal location indicated with the “G” symbol, as shown above. Otherwise it prints an error message. 5. Find path with DFS: The program runs a Depth-First Search algorithm to find a path from the start location ‘S’ to the goal ‘G’. Further explanations about this search process are provided in the following pages. If either of the maze or the start location or the goal location is not defined, it prints an appropriate error message. If a solution path is found, it prints the coordinates of all maze cells along the path, including the start and goal locations e.g., as follows. If there is no solution, it prints an error message instead e.g., “error: no path found.” solution path: (1,1) (1,2) (1,3) (1,4) (2,4) (2,3) (3,3) (4,3) (5,3)/(5,4) (4,4) (3,4) (3,5) (4,5) (5,5) 6. Find path with BFS: Like the above, but the program runs a Breadth-First Search algorithm to find a path from the start location ‘S’ to the goal ‘G’. This process is further elaborated in the following pages. Note that, depending on the maze, DFS and BFS algorithms may find different solution paths. If successful, it prints the path coordinates, otherwise it prints an error message. Methodology and Implementation Details The methodology behind this maze solving process is that storing choices i.e., path cells, in a stack implicitly follows the principle of a Depth-First Search (DFS) traversal, whereas storing them in a queue instead implicitly follows the principle of a Breadth-First Search (BFS) traversal. The search algorithm is therefore the same in both cases, except for the data structure used to store the explored cells in the maze. Accordingly, DFS traverses the maze by arbitrarily following a path until it reaches a dead end, then it backs up to the latest path choice, follows the alternative path in turn until it reaches another dead end, then it backs up again, etc. This search process stops when the goal is reached, or when all possible paths have been explored and there is no solution path from start to goal. By contrast, a BFS traversal of the maze will consider all paths equally, stepping through each one step at a time, progressing further until one of them reaches the goal, or there is no solution. Below is another sample maze where this time DFS and BFS produce different results. In fact, DFS itself will produce different paths depending in which order possible moves are considered. Maze — — — — — — — — S — — — — — — – A – I BFS (always) — — — — S — — — — I @ 1 — — — — — — * I @ @ @ @ — — — — @ G — — – — — — — — — — – – e) * — — — — — G — — — — — — – — 1 – – — — — — — — — — — — — — — — — — DFS (below first, then right…) DFS (right first, then below…) — 1 S @ @ – — — @ 1 @ @1 – – @ @ — — — — – — — — S — — — — — — I @ — — – — I @ @ @ — — — I @ G — — | @ @ @ @ @ @ * — — – @ — — – @ @ — – a – – — G — — @ — — — — I 1 — — – — — In your program, you should represent a maze using two classes: Maze and Cell. A maze i.e., a Maze instance, contains chiefly a rectangular grid of cells i.e., Cell objects, as well as width and height parameters. The cell in the upper left-hand corner conventionally has coordinates (1,1). Each grid cell or location has at most four neighbors: left, right, above, and below. Any two neighboring cells are either connected by empty space or separated by a wall, as depicted in the above maze examples. Empty space between any two cells allows moving from one to the other, in either direction. The start and goal locations are specified by the user as explained earlier. As recapped previously, the process of solving a maze involves continually selecting connected neighbor cells based on the current position until the goal is reached. Detailed pseudo-code is given in the lecture slides that shows how to use a stack and a queue to implement Depth-First Search and Breadth-First Search algorithms, respectively, and the steps were explained in class. Your task is to complete the implementation and test it successfully on various sample mazes. To this aim, you need to add some attributes to Cell class instances, to store wall and neighbor information but also to mark a cell as visited or not. As the given pseudo-code clearly shows, marking cells as visited is essential to avoid search cycles hence infinite loops. You also need to remember which cell was visited immediately before the current cell, to allow retrieving and printing the solution path, as required by the specifications. When implementing DFS and BFS search algorithms, you need to decide in which order the neighbor cells are explored. The order does not matter, but it must be consistent e.g., check the above cell first, then right, below, and left. As illustrated in the examples, the path found by DFS typically depends on this arbitrary order, whereas for BFS it does not. Lastly, note that thinking about this maze solving process and understanding how to use a stack or a queue effectively to accomplish the task is an essential part of this project. Building a successful maze-solving program will strengthen your comprehension of data structures, traversals, and search algorithms, improve your programming skills, and help you better understand tree and graph traversals as seen in subsequent chapters. Success( cell) { while (cell) { output( cell); cell = parent cell); } } Pseudo code for DFS and BFS DFS() { for ( Cellc: maze ) c.setVisited(false); stack S; S.push( startCell); while (not S.empty()) { currentCell = S.top(); S.pop(); if (goal currentCell)) return Success( currentCell); if (not visited currentCell)) { currentCell.setVisited(true); for ( Cell c: currentCell.neighbors()) { if ( not visited()) { c.setParent( currentCell) S.push(c); }} }} return Failure(); Failure() { output( “solution not found” ); } Il need to define: Maze, Cell, setVisited(), visited(), 11 setParent(), parent(), // goal(), neighbors(). } Success(cell) { while (cell) { output( cell); cell = parent cell); } } BFS () { for (Cellc: maze ) c.setVisited(false); queue Q; startCell.setVisited(true); Q.push( startCell); while ( not Q.empty()) { currentCell = Q.front(); Q.pop(); if ( goale currentCell)) return Success( currentCell); for ( Cellc: currentCell.neighbors()) if (not visited()) { c.setVisited(true) c.setParent( currentCell) Q.push(c); }} return Failure(); Failure() { output( “solution not found” ); } Il need to define: Maze, Cell, I/ setVisited(), visited(), I/ setParent(), parent(), I/ goal(), neighbors(). } Note: Code matters. Remember: first, make it work i.e., meeting all specs, then make it nice i.e., readable and well structured, as well as efficient – both memory and performance wise. For a start, you should always name attributes, variables, functions, etc. appropriately and include comments as necessary for each logical block… In the end, you ought to fully test your program on the two sample mazes given to you, and preferably some others of your own making. Appendix 1: Sample code to read a maze from a text file. int main() { ifstream_in(“maze.txt”); char str1[100], str2[100], str3[100]; in.getline(str1, 100); in getline(str2, 100); in.getline(str3, 100); int line = 1, cell 1; while (!in.eof()) { int i = 0, j = 0, k = 1; bool above, below, right, left; cell = 1; cout << "line << line << endl; cout << "strlen = " < strlen(str1) < endl; while (i < strlen(str1) – 1) { above = below = right = left = false; if (str1[i] ' ') i ; // new cell if (str1[i] -') above = true; else if (str1[i] == ') above = false; IL else error į į 3; // wall above if (str2[j] == T) left = true; else if (str2[j] == '') left = false; IL else error į j 4; // left wall lif (str20] — 'I') right = true; Gif (str2[j] == ') right = false; Ise error if (str3[k] == ) below = false; else if (str3[k] = '-') below = true; IL else error kk 4; // wall below cout << "cell = " << cell << endl; cell ; cout << "above: « above << "t"; cout << "below: " << down << endl; cout << "right: " << right << "t"; cout << "left: << left << endl; cout << endl << endl; strcpy(stri, str3); cout << stri << endl; ingetline(str2, 100); in getline (str3, 100); cout << str2 << endl; cout << str3 << endl; line ; } } Appendix 2: Additional exercise for students interested in search algorithms (not graded). Consider extending your maze solving program with Dijkstra's algorithm, in addition to DFS and BFS. The code should be the same as that of BFS, except a priority queue data structure replaces the queue used by BFS. In addition, maze cells need to have different costs, whereas for DFS and BFS the cost of traversing any cell is the same i.e., 1 move each. A priority queue is where elements are sorted in ascending order of values instead of FIFO for plain queues). The C STL library provides a priority queue class, which is as easy to use as the stack or queue classes. Whereas BFS will find the path with the fewest steps. Dijkstra's algorithm will find the path with the minimum cost. Note that, if all step costs are the same, the two algorithms will perform identically. As such, varying cell costs must be defined before applying Dijkstra's algorithm. The cost of a path is the total cost of all cells on the path, but the cost of passing through a cell is arbitrary, and depends solely on the scenario or application one chooses. One possibility is to consider that different maze locations consist of different terrain e.g., either concrete, sand, or water, with costs such as 1, 2, or 3, respectively. An example is shown below on the left, where the above corridor is made of concrete and the one below is water. In that case, the longer path between entrance and exit is actually that of minimum cost i.e., above. 1 1 – — — – – — — | 21 1 1 11 — — — — — 1 2 2 3 3 3 3 2 11 — — – – — — — — — — – — — — I c CI — — — — — I c х CI — — — — — — — Another sample scenario is to consider that turns have a higher cost as opposed to straight moves. In the maze shown above on the right corner cells may have a cost of 4 vs. 1 only for the other cells. One may also assign a different cost for intersections… The path found would thus be that which minimizes turns, even if it requires more steps. Possibilities are truly endless… Java -Greenfoot Based Questions 1)Which Of The Following Statements Correctly Calls The Static PlaySound() Java -Greenfoot based questions 1)Which of the following statements correctly calls the static playSound() method from the Greenfoot class. Assume the Greenfoot class is public and your class doesn’t inherit from it. Group of answer choices playSound(“test.wav”); GreenfootplaySound(“test.wav”); Greenfoot().playSound(“test.wav”); Greenfoot.playSound(“test.wav”); 2) Create a constructor for a class named NewWorld 3) What do you need to create an object in Greenfoot/Java Group of answer choices a variable the addObject method the new keyword the new keyword and the constructor

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more