Questions
Write a method that will accept a 2D character array. The 2D array represents a grid...

Write a method that will accept a 2D character array. The 2D array represents a grid (table) of characters in which a triple may occur. A triple is 3 matching characters. This method will search through the array to determine whether or not it contains a set of 3 matching characters. Specifically, it will check to see if the 3 matching characters appear somewhere in the array as three adjacent characters either horizontally (left to right) or vertically (top to bottom). You should NOT consider diagonals. If a set is found, stop searching and return the character in the set, if no set is found throw the SetNotFoundException and provide an appropriate message.

You may either write your answer in the space provided or upload a PDF containing your solution.

Examples:
For the following array a search will result in a triple being found and returning the character C:

For the following array a search will result in a triple being found and returning the character B:

For the following array a search will result in a triple NOT being found and throwing the SetNotFoundException:

/**
Searches the character grid for the appearance of a set of 3 identical characters, horizontally or vertically.
@param searchGrid The 2D character array in which the search will occur.
@return The character that was in the set.
@throws SetNotFoundException if the searchGrid does not contain a set of exactly 3 matching characters.
*/
public static char setSearchChar(char[][] searchGrid) throws SetNotFoundException {

The language is Java

In: Computer Science

Write the test cases for searching flights in a flight reservation system. What testing method can...

Write the test cases for searching flights in a flight reservation system. What testing method can be used?

In: Computer Science

Try to make it as simple as you can. Please provide the answers with some examples...

Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.

Linux

Using the following directory structure (See Structure question # 3)

-Determine the absolute path for the following files and directories:

- Your_Name_goes_here.dat

-Sales

-Assuming your current directory is RegionA, determine the relative pathname for the following files and directories:

-West1.dat

-RegionB

$HOME

Project4

Payroll

.checks.dat

Pay2.dat

Sales

RegionA

East.dat

RegionB

West1.dat

Your_Name_goes_here.dat

West3.dat

In: Computer Science

Try to make it as simple as you can. Please provide the answers with some examples...

Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.

Linux

Using the following directory structure (See Structure question # 3)

-Determine the absolute path for the following files and directories:

- Your_Name_goes_here.dat

-Sales

-Assuming your current directory is RegionA, determine the relative pathname for the following files and directories:

-West1.dat

-RegionB

$HOME

Project4

Payroll

.checks.dat

Pay2.dat

Sales

RegionA

East.dat

RegionB

West1.dat

Your_Name_goes_here.dat

West3.dat

In: Computer Science

Create a visualization of a hash table containing at least 10 items using one of the...

Create a visualization of a hash table containing at least 10 items using one of the hash table collision techniques covered in this section. Fully describe the image and how the items came to be in their given positions.

In: Computer Science

Try to make it as simple as you can. Please provide the answers with some examples...

Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.

Linux

What is the i-node , and what is the major information stored in each node?

What is the difference between moving (mv) a file and copying (cp) a file?

In: Computer Science

Create a C++ program that creates instances of a Struct using an Array (you can choose...

Create a C++ program that creates instances of a Struct using an Array (you can choose the number of instances to create). You can also use either user input or an initialization list to initialize 3 peoples names. Make sure that the values stored in each member are printed to the screen.

In: Computer Science

This question need to be solved using java coading :- I. Input All input data are...

This question need to be solved using java coading :-

I. Input

   All input data are from a file "in.dat". The file contains a
sequence of infix form expressions, one per line. The character '$' 
is an end mark. For example, the following file has four infix form 
expressions:

   1 + 2 * 3 ^ ! ( 4 == 5 ) $
   3 * ( 6 - 4 * 5 + 1) + 2 ^ 2 ^ 3 $
   77 > ( 2 - 1 ) + 80 / 4 $
   ! ( 2 + 3 * 4 >= 10 % 6 ) && 20 != 30 || 45 / 5 == 3 * 3 $

Each expression is a sequence of tokens (i.e., constant integers,
operators, and end mark) separated by spaces. There is no variable.


II. Output

   Output data and related information are sent to the screen.
Your program should do the following for each expression:

   (1) printing the expression before it is manipulated;
   (2) showing the converted postfix form expression;
   (3) showing the expression tree;
   (4) printing the fully parenthesized infix form expression;
   (5) reporting the value of the expression.


III. Operators

   The following operators are considered. They are listed in the
decreasing order of precedence.

   Token            Operator            Associativity

    !               logical not         right-to-left
    ^               exponentiation      right-to-left
    *  /  %         multiplicative      left-to-right
    +  -            additive            left-to-right
    <  <=  >  >=    relational          left-to-right
    ==  !=          equality            left-to-right
    &&              logical and         left-to-right
    ||              logical or          left-to-right


IV. Other Requirements

   Since a large amount of information are to be displayed on the
screen, it is mandatory for your program to provide users a prompting
message such as

          Press <Enter> to continue ...

after each expression is processed, so that users have the chance to
check the output of your program carefully.


V. Algorithm: Infix_to_postfix conversion

  Input:  An infix form expression E = t1 t2 t3 ... $,
          which is a sequence of tokens.
  Output: The postfix form expression of E.

  Algorithm: 
  {
    do {
      get the next token t;
      case (t) {
         operand: place t onto the output;
                  break;
        operator: while (stack s is not empty
                    && stacktop(s) is not a left parenthesis)
                    && precedence(stacktop(s)) >= precedence(t)
                       // assuming left-to-right associativity, 
                       // not for the exponentiation operator ^, 
                       // which has right-to-left associativity 
                  {
                        pop(x,s);
                        place x onto the output;
                  }
                  push(t,s);
                  break;
               (: push(t,s);
                  break;
               ): while (stacktop(s) is not a left parenthesis) {
                      pop(x,s);
                      place x onto the output;
                  }
                  pop(x,s);
                  break;
        end mark: while (stack s is not empty) {
                      pop(x,s);
                      place x onto the output;
                  }
                  place the end mark onto the output;
                  break;
      }
    } while (t is not the end mark);
  }

This below is "in.dat file"

12 * 23 <= ( ( ( 3456 ) ) +    ( 6789 ) ) $ 1
4 ^ 3 - ( 2 + 4 * 15 ) - ( 90 / 3 != 30 ) $ 2
! ( 222 < 111 ) + 2 * 3 ^ ( 29 - 3 * 9 ) > 18 && 1234 == 1234 $ 1
( 2 * ( 62 % 5 ) ) ^ ( ( 4 - 2 ) ) - 2 ^ 2 ^ 2 $ 0
( ( 9 / ( 5 - 2 ) + 2 ) * ( 2 ^ 2 * 2 ) - 79 ) || ! ( 65432 > 54321 ) $ 1
( ( 9999 >= 8888 ) + 2 ) * ( 4 / ( 999 - 997 ) ) - 2 ^ ( 5 - 3 ) $ 2

In: Computer Science

Develop a C++ class called PrimeNumberGenerator. An object of this class will generate successive prime numbers...

Develop a C++ class called PrimeNumberGenerator. An object of this class will generate successive prime numbers on request. Think of the object as being similar to the digital tasbeeh counter. It has a reset button which makes the counter return to 0. There is also a button to get the next prime number. On the tasbeeh, pressing this button increments the current value of the counter. In your object, pressing this button would generate the next prime number for display. You’ll implement the reset button as a member function reset() and the other button as a function getNextPrime(). When an object is first created and the getNextPrime() function is called, it will return the first prime number, i.e., 2. Upon subsequent calls to the getNextPrime() function, the subsequent prime numbers will be returned. Define any others functions such as constructor and attributes that you need. According to Wikipedia: “a prime number is a natural number greater than 1, that has no positive divisors other than 1 and itself.”

In: Computer Science

Prove that the following language is context-free: L = { ω#x | ωR is a substring...

Prove that the following language is context-free: L = { ω#x | ωR is a substring of x and x, w ∈ {0,1}* } where ωR is ω reversed.

In: Computer Science

Make a program that calculates the total of a retail sale. The program should ask the...

Make a program that calculates the total of a retail sale. The program should ask the user for the following: the retail price of the item being purchased and the sales tax rate. Once the information has been entered, the program should calculate and display the following: the sales tax for the purchase and the total sale.

In: Computer Science

Write a menu-driven program to read 3 employees' information from a text file called “ EmployeeFile”...

Write a menu-driven program to read 3 employees' information from a text file called “ EmployeeFile” for this example but that can be edited to add more employees later.
Each employee has a name field, ID fields, and a Salary Record.
The Salary Record has weekly hours, rate per hour, gross salary, Tax, and net salary field.

1.1 Implement the project with queue using pointers

1.2 Write push and pop functions for queue using pointers

C++

EmployeeField.txt example


John_Doe 123456 40 45 4500 200 4300
Billy_Bob 654321 40 200 4000 200 3800
Kate_Johnson 531642 40 300 12000 200 11800

please make sure it works on free compilers online like https://repl.it/languages/cpp to be tested.

In: Computer Science

Program description is given below!! Client and Server Online Game Jumble: In this assignment, you need...

Program description is given below!!

Client and Server Online Game Jumble: In this assignment, you need to use socket programming to implement an online game Jumble. Generate a random work in server and send it to client and ask for input and then client send the guessed word to server and server check whether its in a word.txt file and reply Win or lose.

Note:

  • Reading content of a text file to a list and generating random number, and game logic is already implemented in jumble.py
  • ONLY need modification in echo-client.py and thread-server.py to implement socket programming.

Test your code and make sure the server can serve multiple players simultaneously. Note the words should be generated independently for each client, so that normally different clients are guessing different words

-----------------------Code--------------------

"""-----------------thread-server.py----------------------
Server side: open a socket on a port, listen for a message from a client,
and send an echo reply; echoes lines until eof when client closes socket;
spawns a thread to handle each client connection; threads share global
memory space with main thread; this is more portable than fork: threads
work on standard Windows systems, but process forks do not;
"""

import time, _thread as thread # or use threading.Thread().start()
from socket import * # get socket constructor and constants
myHost = '' # server machine, '' means local host
myPort = 50007 # listen on a non-reserved port number

sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP socket object
sockobj.bind((myHost, myPort)) # bind it to server port number
sockobj.listen(5) # allow up to 5 pending connects

def now():
return time.ctime(time.time()) # current time on the server

def handleClient(connection): # in spawned thread: reply
time.sleep(5) # simulate a blocking activity
while True: # read, write a client socket
data = connection.recv(1024)
if not data: break
reply = 'Echo=>%s at %s' % (data, now())
connection.send(reply.encode())
connection.close()

def dispatcher(): # listen until process killed
while True: # wait for next connection,
connection, address = sockobj.accept() # pass to thread for service
print('Server connected by', address, end=' ')
print('at', now())
thread.start_new_thread(handleClient, (connection,))

dispatcher()

"""------------------echo-client.py-------------------------
Client side: use sockets to send data to the server, and print server's
reply to each message line; 'localhost' means that the server is running
on the same machine as the client, which lets us test client and server
on one machine; to test over the Internet, run a server on a remote
machine, and set serverHost or argv[1] to machine's domain name or IP addr;
Python sockets are a portable BSD socket interface, with object methods
for the standard socket calls available in the system's C library;
"""

import sys
from socket import * # portable socket interface plus constants
serverHost = 'localhost' # server name, or: 'starship.python.net'
serverPort = 50007 # non-reserved port used by the server

message = [b'Hello network world'] # default text to send to server
# requires bytes: b'' or str,encode()
if len(sys.argv) > 1:   
serverHost = sys.argv[1] # server from cmd line arg 1
if len(sys.argv) > 2: # text from cmd line args 2..n
message = (x.encode() for x in sys.argv[2:])

sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP/IP socket object
sockobj.connect((serverHost, serverPort)) # connect to server machine + port

for line in message:
sockobj.send(line) # send line to server over socket
data = sockobj.recv(1024) # receive line from server: up to 1k
print('Client received:', data) # bytes are quoted, was `x`, repr(x)

sockobj.close() # close socket to send eof to server

--------------------------jumble.py----------------------

import random
F = open('wordlist.txt')
words = F.readlines()
F.close()
while True:
word = words[random.randrange(len(words))]
while len(word) > 5 or len(word) == 0:
word = words[random.randrange(0, len(words))]
word = word.rstrip()
old_word = word
word = list(word)
while word:
print(word.pop(random.randrange(len(word))), end = ' ')
print('\nType your answer')
match_word = input()
new_word = match_word + '\n'
if new_word in words and set(match_word) == set(old_word):
print('You win.')
else:
print('The answer is ' + old_word)

-------------------wordlist.txt---------------------

ab
aba
abaca
abacist
aback
abactinal
abacus
abaddon
abaft
abalienate
abalienation
abalone
abampere
abandon
abandoned
abandonment
abarticulation
abase
abased
abasement
abash
abashed
abashment
abasia
abasic
abate
abatement
abating
abatis
abatjour
abattis
abattoir
abaxial
abba

------------------------------------------------

Thank in advance! Please help me soon. I will UPVOTE!!

In: Computer Science

Consider a B-tree allowing splits and free-on-empty. Please show an example of these operations on a...

Consider a B-tree allowing splits and free-on-empty. Please show an example of these operations on a data structure containing 15 data items, a fanout of three, and at most three data items per node. Also give the search algorithm (use a give-up scheme).

In: Computer Science

The ReservedRoom Class: Each ReservedRoom entry has three (data) fields: roomID (string) of the classroom e.g....

  1. The ReservedRoom Class:

Each ReservedRoom entry has three (data) fields:

  • roomID (string) of the classroom e.g. W330, W350, W361, etc.
  • courseID (string) which stores which course reserves this room
  • time (int): which stores the start time of the reserved slot i.e. 1820 means the reservation starts at 18:20

Thus, the ReservedRoom class will consist of three data members (roomID and courseID, time), in addition to the associated methods needed as follows.

  1. The constructor ReservedRoom (r, c, t): constructs a ReservedRoom object with the given parameters.
  2. String getRoom(): returns the roomID field.
  3. String getCourse(): returns the courseID field.
  4. int getTime(): returns the time field.
  5. String toString(): returns a String representation of this ReservedRoom entry.

Implement the ReservedRoom ADT using Java programming language.

The RoomsBoard Class:

RoomsBoard is a singly-linked list of ReservedRoom. The class RoomsBoard supports the following operations:

  1. void add(ReservedRoom r): adds a new ReservedRoom object to RoomsBoard. The ReservedRoom object should be inserted into the RoomsBoard list such that the nodes of the list appear in non-decreasing order of time.
  2. void remove(String roomID): removes all occurrences of the room with this ID.
  3. void remove_all_but(String roomID): removes all the reserved rooms except the room with this ID.
  4. void removeAll(): clears the RoomsBoard by removing all rooms entries.
  5. void split( RoomsBoard board1, RoomsBoard board2): splits the list into two lists, board1 stores the list of reserved rooms before 12:00 and board2 stores the list of rooms after 12:00.
  6. void listRooms(): prints a list of the reserved rooms in the roomsboard, in non-decreasing order.
  7. Void listReservations( roomID): prints the list of reservations for this room in the roomsboard, in non-decreasing order.
  8. int size(): returns the number of reserved rooms stored in the roomsboard.
  9. boolean isEmpty(): returns true if the RoomsBoard object is empty and false otherwise.

Implement the RoomsBoard ADT with a singly-linked list using Java programming language. The implementation must utilize the generic class Node as described in Section 3.2.1 of your text. Figure 1 shows a sample RoomsBoard object.

  1. The Menu-driven Program:

Write a menu-driven program to implement a roomsboard for a classroom reservations system. The menu includes the following options:

  1. Add new room.
    The program will prompt the user to enter the roomID, courseID and time of the new reserved room, then will call the add() method from the RoomsBoard class.
  2. Remove all occurrences of a room.
    The program will prompt the user to input the room ID to be removed, then call the remove() method from the RoomsBoard class.
  3. Remove all rooms except a room.
    The program will prompt the user to input the room ID to be kept, then call the remove_all_but () method from the RoomsBoard class.
  4. Clear the RoomsBoard.

The program will call the removeAll() method from the RoomsBoard class.

  1. Split the list of rooms into two lists by calling the method split() from the RoomsBoard class.
  2. Display RoomsBoard.
    The program will call the listRooms() method from the RoomsBoard class.
  3. Display the reservations of a room.
    The program will call the listReservations() method from the RoomsBoard class to display all reservations of this room with the given roomID.
  4. Exit.

The program should handle special cases and incorrect input, and terminate safely. Examples include (but not limited to) the following:

  1. Removing a RoomsEntry object from an empty RoomsBoard object.
  2. Removing a ReservedRoom object with a roomID that is not in the RoomsBoard object.
  3. Displaying an empty RoomsBoard object.
  4. Entering an incorrect menu option.

In: Computer Science