Questions
Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where...

Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from the getpid( ) function) to the server. Have the server read the privateFIFO name and write a message back to the client. Read the message and print it on the client side. Take screenshots of the output from your client and server programs. Send the output to Blackboard. What I'm checking for on this homework is that the name got created in the client and passed correctly to the server and the server can respond to the client. Turn the background of your window white and increase the font size.

Write in C, Will be used on Putty.

Thank you.

In: Computer Science

You are in charge of security at a casino, and there is a thief who is...

You are in charge of security at a casino, and there is a thief who is trying to steal the casino's money! Look over the security diagrams to make sure that you always have a guard between the thief and the money!
There is one money location, one thief, and any number of guards on each floor of the casino.

Task in Java, Python and CPP:
Evaluate a given floor of the casino to determine if there is a guard between the money and the thief, if there is not, you will sound an alarm.

Input Format:
A string of characters that includes $ (money), T (thief), and G (guard), that represents the layout of the casino floor.
Space on the casino floor that is not occupied by either money, the thief, or a guard is represented by the character x.

Output Format:
A string that says 'ALARM' if the money is in danger or 'quiet' if the money is safe.

In: Computer Science

Consider the language defined as such: L = { w$w’ : w is a string of...

  1. Consider the language defined as such:

L = { w$w’ : w is a string of numbers 0-9 and can be of length ≥ 0, and w’ is the reverse string of w}

Write a recursive grammar that defines all strings in the language.

  1. Using the language above, write the Java code (using recursion) that will recognize if a string is part of the language or not.

In: Computer Science

A priority queue is a special queue that adjusts the location of items based on some...

  1. A priority queue is a special queue that adjusts the location of items based on some priority value. When inserted, a new value is placed in the queue ahead of every other item that has a lower priority than it. This gives us a queue that removes items from the front removing highest priority first, and from items with similar priority the ones that were inserted first. For example, if we inserted the following items with the priority {A, 1}, {B,2}, {C,2}, {D,3}, {E,1} where the lower number is a lower priority, our queue will have the items from front to back: D,B,C,A,E. Using the partial code below, you are to implement the Enqueue method so that the new node is inserted into the appropriate place in the queue based on the priority. (Assume that a higher number is higher priority, for example 0 is lowest and 10 is highest)

class Node<V,P>

{

      public V value;

      public P priority;

      public Node<V,P> next;

     

      Node(V value, P priority)

      {

           this.value = value;

           this.priority = priority;

      }

}

class PriorityQueue<V,P>

{

      private Node<V,P> head;

      private Node<V,P> tail;

     

      ...

      public void Enqueue(V value, P priority)

      {

In: Computer Science

sorting- Inversion Count for an array indicates Language: c++ Your solution has to be O(n log...

sorting- Inversion Count for an array indicates

Language: c++

Your solution has to be O(n log n).

please write comments

*countinv.cpp*

// Count inversions - homework

// Based off of mergesort

#include <vector>

#include <algorithm> // For copy

using namespace std;

int mergeInv(vector<int>& nums, vector<int>& left, vector<int>& right) {

// You will need this helper function that calculates the inversion while merging

// Your code here

}

int countInv(vector<int>&nums) {

// Your code here

}

//test code

/* Count the number of inversions in O(n log n) time */

#include <iostream>

#include <vector>

using namespace std;

int countInv(vector<int>& numvec);

int main()

{

int n;

vector<int> numvec{4, 5, 6, 1, 2, 3};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 9

  

numvec = {1, 2, 3, 4, 5, 6};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 0

  

numvec = {6, 5, 4, 3, 2, 1};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 15

  

numvec = {0, 0, 0, 0, 0, 0};

n = countInv(numvec);

cout << "Number of inversions " << n << endl;; // Should be 0

}

*countinv_test.cpp*

/* Count the number of inversions in O(n log n) time */

#include <iostream>

#include <vector>

using namespace std;

int countInv(vector<int>& numvec);

int main()

{

int n;

vector<int> numvec{4, 5, 6, 1, 2, 3};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 9

  

numvec = {1, 2, 3, 4, 5, 6};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 0

  

numvec = {6, 5, 4, 3, 2, 1};

n = countInv(numvec);

cout << "Number of inversions " << n << endl; // Should be 15

  

numvec = {0, 0, 0, 0, 0, 0};

n = countInv(numvec);

cout << "Number of inversions " << n << endl;; // Should be 0

}

In: Computer Science

IN java Create a New Java Project called LastNameDuplicate. //Given an array of N elements with...

IN java

Create a New Java Project called LastNameDuplicate.

//Given an array of N elements with each element between 1 and N, write a program to determine whether there are any duplicates.

//You must prompt the user for the array elements.

//Display the contents of the array, along with the values that are duplicated and how many times they appeared in the array.

//NOTE: N should be at least 15. Input Validation: Verify that each element entered has a value between 1 and N. If an incorrect value is entered, continuously prompt for a new value. This should not halt or terminate your program.

In: Computer Science

Technical reviews can be formal, informal, or somewhere in between. How might you decide which type...

Technical reviews can be formal, informal, or somewhere in between. How might you decide which type of review process best fits your project? What specific qualities of your project would help guide this decision?

In: Computer Science

OBJECTIVE Upon completion of this exercise, you will have demonstrated the ability to: Use C# loops...

OBJECTIVE

Upon completion of this exercise, you will have demonstrated the ability to:

  • Use C# loops
  • Construct conditions

INTRODUCTION

Your instructor will assign one of the following projects, each involves the user of loops and the construction of conditions to control them.

CODING STANDARDS

The following coding standards must be followed when developing your program:

  • An opening documentation at the beginning of the source file describing the purpose, input, process, output, author, last modified date of the program.
  • Write only one statement per line.
  • Write only one declaration per line.
  • Use camelCase for local variable names.
  • Use UPPER_CASE for constant variable names.
  • If continuation lines are not indented automatically, indent them one tab stop (four spaces).
  • Do NOT use goto or break statements in your looping structure.

PROJECTS

  1. Create a C# Console App named CPSC1012-Exercise04-YourName where YourName is your first and last name.
  2. Solve the problems below:
    1. Write a program that will read a sequence of numbers from the keyboard (you are free to choose the input flow method of your choice), and display the minimum, maximum, average, and range (highest minus lowest) of the entered values.  Validate the input.

DEMONSTRATION/SUBMISSION REQUIREMENTS

  1. Demonstrate the execution of your program in which you show all functionality of your program.
  2. Upload your completed project to Moodle.

In: Computer Science

java Convert the following Infix expression to a Postfix expression. Show all work                            Infix Expres

java

  1. Convert the following Infix expression to a Postfix expression. Show all work

                           Infix Expression                                                 Stack                             Postfix Expression

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

8 - 9*(2 + 1/4) + 3*7                                                     (empty)                            (blank)

  1. Evaluate the following Postfix expression. Once again, show all work.

           Postfix                                               Stack                     Result

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

           2 7 + 12 4 / * 8 5 + -

In: Computer Science

for the research topic Effect of Cloud-Based Services on Small Businesses in Developing Countries: Case Study...

for the research topic

Effect of Cloud-Based Services on Small Businesses in Developing Countries: Case Study of Khomas Region, Namibia

Write the following

1. limitations

2 delimitations

3 research questions

4. research ethics

please note to put your citations and reffeences

In: Computer Science

OBJECTIVE: In the second assignment, you started coding the NineGaps game by creating the skeleton of...

OBJECTIVE: In the second assignment, you started coding the NineGaps game by creating the skeleton of the program including the loops, inputs/outputs, and some conditions without going to the details of the game. In this third assignment, we are going to complete the game by coding the details, using what we learned so far, especially working with arrays. YAY! At the end of this assignment, we can actually play with the very first game that we created by ourselves (at least for some of us!). Here You Go…! Complete the NineGaps game: Problem 1: Simulating a two-dimensional array using one-dimensional array. In COMP-1400, we only talk about one-dimensional arrays, and two-dimensional (or more) arrays will be discussed in COMP-1410. However, in NineGaps game, we need to have a table of digits as well as table of operators for the game board. In this problem we would like to simulate a two-dimensional array using a one-dimensional array. For instance, to create a n by m table (a table with n rows and m columns) of digits, we need to create a one-dimensional array with size of n*m. Therefore, row 0 and column 0 of the table (black color) will be represented by position 0 of our array. Or row 1 and column 1of the table (yellow color) will be mapped to the cell#4 in our array. Or row 3 and column 0 of the table (dark blue) is represented by cell#9 in our array. The first step to simulate the process is to find and implement the mapping rule. Assuming we want to add an integer value in a particular row and column of the table, where 0. The language is C.

In: Computer Science

Using a Stack, describe the algorithm below (with pre conditions and post conditions) how you would...

  1. Using a Stack, describe the algorithm below (with pre conditions and post conditions) how you would check a block of code and be sure it has the appropriate amount of curly brackets { }. (java)

In: Computer Science

C++ Programming Coding Thank you -Suppose a car has an identifier (carid) and consists of an...


C++ Programming Coding
Thank you

-Suppose a car has an identifier (carid) and consists of an engine(Engine) and a body (Body).

-Engine is an integer type and has engine number (engineNo) and string type engine name (engineName).

-Body is an integer type and has a body number (bodyNo) and a string type body name (bodyName).

-Write a program that creates a Car object and copies that object.

(In both cases below, print the original and a copy to check the results.)
—Shallow copy
—Deep copy

In: Computer Science

Create and test a Windows Console application that displays the following patterns separately, one after the...

Create and test a Windows Console application that displays the following patterns separately, one after the other. You MUST use nested for loops to generate the patterns, like the example in the PowerPoint slides from this chapter. All asterisks (*) should be displayed by a single statement of the form Console.Write("*"); which causes the asterisks to display side by side. A statement of the form Console.WriteLine(); can be used to move to the next line. A statement of the form Console.Write(" "); can be used to display a space for the last two patterns. There should be no other output statements in the application, other than labeling each pattern. The application's output should look like the following: Remember, use Debug, Start Without Debugging (CTRL-F5) to run your Console application. For Pattern C and Pattern D, you will need TWO loops (one after the other) nested inside your outer loop. The first loop will produce a certain number of spaces. The second loop will produce a certain number of stars. One of these numbers will be the current value of your outer loop's control variable. The other number must be calculated using ALGEBRA. Consider, how many spaces and stars are being output on each row? Always the same amount (here, 10 or MAX_ROWS, if using the same named constant as in the PowerPoint slide code given for Pattern A). So, (# spaces) + (# stars) = MAX_ROWS This equation is easy to solve for the number of spaces needed (assuming your outer loop control variable represents that number of stars per row, as in the PowerPoint slide code given for Pattern A): (# spaces) = MAX_ROWS - (# stars) or (# spaces) = MAX_ROWS - row if you name your variables as in the PowerPoint slide code given for Pattern A. So, you can make your first nested loop start at 1 and count up to (MAX_ROWS - row), outputting a single space on each iteration

Pattern A

*
**
***
****
*****
******
*******
********
*********
**********

Pattern B

**********
*********
********
*******
******
*****
****
***
**
*

(c)
**********
   *********
     ********
       *******
         ******
            *****
              ****
                ***
                  **
                    *

(d)
                    *
                  **
                ***
              ****
            *****
          ******
       *******
     ********
   *********

In: Computer Science

Finish the calories_burned_functions.py program that we started in class. Take the original calories_burned program and rework...

Finish the calories_burned_functions.py program that we started in class. Take the original calories_burned program and rework it so that it uses two functions/function calls.

Use the following file to get your program started:

"""

''' Women: Calories = ((Age x 0.074) - (Weight x 0.05741) + (Heart Rate x 0.4472) - 20.4022) x Time / 4.184 '''
''' Men: Calories = ((Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) - 55.0969) x Time / 4.184 '''
"""
#Declare Variable names and types

age_years = int(input())
weight_pounds = int(input())
heart_bpm = int(input())
time_minutes = int(input())

#Performing Calculations

calories_woman = ( (age_years * 0.074) - (weight_pounds * 0.05741) + (heart_bpm * 0.4472) - 20.4022 ) * time_minutes / 4.184

calories_man = ( (age_years * 0.2017) + (weight_pounds * 0.09036) + (heart_bpm * 0.6309) - 55.0969 ) * time_minutes / 4.184

#Print and format results in detail

print('Women: {:.2f} calories'.format(calories_woman))
print('Men: {:.2f} calories'.format(calories_man))

"""

#Here are the functions to this program

def calc_calories_woman(years, pounds, heartrate, minutes):
  
return ( (age_years * 0.074) - (weight_pounds * 0.05741) + (heart_bpm * 0.4472) - 20.4022 ) * time_minutes / 4.184

#This is the main part of the program

#------------------------------------------------------------------------------

#Prompt the user at the keyboard for the necessary information

age_years = int(input("Please enter your age: "))
weight_pounds = int(input("Please enter your weight: "))
heart_bpm = int(input("Please enter your heart rate: "))
time_minutes = int(input("Please enter the time: "))

#Calculate the calories

calories_woman = ( (age_years * 0.074) - (weight_pounds * 0.05741) + (heart_bpm * 0.4472) - 20.4022 ) * time_minutes / 4.184

calories_man = ( (age_years * 0.2017) + (weight_pounds * 0.09036) + (heart_bpm * 0.6309) - 55.0969 ) * time_minutes / 4.184

#Print the results

print('Women: {:.2f} calories'.format(calories_woman))
print('Men: {:.2f} calories'.format(calories_man))

In: Computer Science