Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

1.      Dynamic loading of functions 

b.     Your main program and interpret function should be compiled separately. In the file ~/.bash_profile export the environment variable LD_LIBRARY_PATH      export  LD_LIBRARY_PATH=.  

This will take effect the next time you log in.  To make this effective in your current session you would have to export the variable manually.  

i.    replace the default config file with your 2nd config file and send a SIGHUP signal to your program. Verify that your program is now running the implemented functions. 

ii.       Include code that loads the functions (see example pluginShell.c) and modify it so that it also loads help.

iii.     When the program starts up it should call the routine that loads the 1st config file.  V


1.      Implement a Command Interpreteron apollo for the following commands. Note that each command follows a different pattern:  

d.     sumsqnum1 num2 num3 .... 

Squares each number sums the result.  Returns the sum and the square root of the sum as output. The numbers should be converted from their string values to doubles to do the calculation.  If no numbers are listed result should be 0.0 0.0.

e.     time timeformat

The example provided returns the current time in Japan. This command should return the current time in the specified format  In CENG 151 you learned to display the time in using different format codes using the -d flag. Use the C function timeto retrieve the current tim


The media company global ad


The media company "GlobalAd" has received a

batch of advertisements from different product

brands. The batch of advertisements is a

numeric value where each digit represents the

number of advertisements the media company

has received from different product brands.

Since the company banners permit only even

numbers of advertisements to be displayed, the

media company needs to know the total

number of advertisements it will be able to

display from the given batch.

Write an algorithm to calculate the total

number of advertisements that will be

displayed from the batch.

Input

The input consists of an integer batch,

representing the batch of advertisements

Output

Print an integer representing the total number

of advertisements that will be displayed by the

media company

Constraints

0 < batchs 109


1.  Implement a Command Interpreteron apollo for the following commands. Note that each command follows a different pattern:  

c.help  cmd1  cmd2 cmd3 ...

i.       The command helpby itself should list the names of all the commands supported by your program and only the names.

ii.      Extend the parallel data structure of command names and methods used in the example code to include a 3rd field containing a short help message. If the help command arrives with additional tokens display the help for each command listed..

d.     sumsqnum1 num2 num3

Squares each number sums the result.  Returns the sum and the square root of the sum as output. The numbers should be converted from their string values to doubles to do the calculation.  If no numbers are listed result should be 0.0 0.0..



Part 2

Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.

Include all of the following in your Learning Journal:

  • An explanation of each stage of development, including code and any test input and output.
  • The output of three calls to your function with different arguments.

Part 1

Section 6.2 of your textbook describes incremental development. Do the exercise at the end of that section:

As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)

After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.

Include all of the following in your Learning Journal:

  • An explanation of each stage of development, including code and any test input and output.
  • The output of hypotenuse(3,4).
  • The output of two additional calls to hypotenuse with different arguments.

def factorial(n):

space = ' ' * (4 * n)

print(space, 'factorial', n)

if n == 0:

print(space, 'returning 1')

return 1

else:

recurse = factorial(n-1)

result = n * recurse

print(space, 'returning', result)

return result

space is a string of space characters that controls the indentation of the output. Here is the

result of factorial(4) :


factorial 4

factorial 3

factorial 2

factorial 1

factorial 0

returning 1

returning 1

returning 2

returning 6

returning 24

If you are confused about the flow of execution, this kind of output can be helpful. It takes

"Debugging" lists three possibilities to consider if a function is not working.

  • Describe each possibility in your own words.
  • Define "precondition" and "postcondition" as part of your description.
  • Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.
Write a program to check the overlapping of one strings suffix with the prefix of another string

Command Interpreter & AF_UNIX Sockets

1.      Implement a Command Interpreteron apollo for the following commands. Note that each command follows a different pattern:  

 

a.      Implement a command serverwith a set of stub routines for the commands listed in 1c,d,e,f and 2a. Test it to make sure each of the commands is recognized properly and that a bad command is also recognized.  

 

b.     Command server and client (

i.        Modify your command server so that it communicates via a pipe rather than stdin. Use your own name for the name of the pipe.

ii.      Modify pipeChatClient2 so that it communicates to the command server via your pipe. Refer to readlineDemo.cand modify the program so that saves the commands entered into a file.  This will create your client program.



LATEST TUTORIALS
APPROVED BY CLIENTS