Programming Homework Help

Montgomery College Rockville Campus Shell Program Execution Command

 

Parsing command lines

At a high level, our shell does two things: parse command lines, and execute those command lines. This piece of the lab is about parsing; the next (and longer) piece is about executing. In our shell, parsing has two aspects (which are interleaved): converting a typed command line into a sequence of tokens, and converting that sequence of tokens into an internal representation (the execution piece acts on this internal representation). Tokens can be command names, command arguments, or special shell tokens. For instance, the command ls -l “foo bar” > zot consists of five tokens: “ls”, “-l”, “foo bar” (the quotes are not part of the token), “>”, and “zot”. To motivate the internal representation, notice that command lines can contain multiple commands, separated by various operators: ;, &, |, &&, ||, (, or ). Our internal representation is a list of commands, with information about the operator that separates each command from the next (along with other information, such as what kinds of redirection the user specified for each command). The data structure that implements this representation is (mostly) a linked list of commands, with each node in the list containing information about the command (we said “mostly” because, owing to subshells, the data structure can be thought of as a hybrid of a list and a tree). The key structure in the code is the struct command (in cmdparse.h). A good way to get familiar with a code base is to look at the key data structures and interfaces (which are usually in header files). To this end: Read the code and comments in cmdparse.h. The implementation of parsing is in cmdline.c, and is driven from main.c. You will need to have a solid understanding of this code in order to do the remaining exercises. Therefore: Familiarize yourself with cmdparse.c and main.c. It may help to play around with the parser for the shell that you have been given: $ make # if you have not already built the code $ ./cs202sh -p # -p means “parse only” cs202$ ls -l “foo bar” > zot Inspect the output. You can and should try typing in some of the commands from the warm-up section. There is missing functionality in cmdparse.c. It does not handle parentheses properly, and it does not free the memory that it uses. Your job is to fill these gaps.

Exercise 1. In cmdparse.c, complete cmd_parse() so that it handles parentheses and subshells. If you did this correctly, then make test should now pass the first five tests (it will by default pass some of the successive tests).

Exercise 2. In cmdparse.c, complete cmd_free(). We do not provide testing code for this. One hint: what does strdup() do? Type man strdup to find out. A helpful resource may be gdb. Speaking of resources….in this and the next part of the lab, you will need some comfort with C. We have been building this comfort in class, but you may still feel shaky. Here are some potentially helpful resources:

C for Java Programmers (Nagarajan and Dobra, Cornell) C for Java Programmers (Henning Schulzrinne, Columbia) A Tutorial on Pointers and Arrays in C (Ted Jensen)

Executing command lines

In this part of the lab, you will write the code to execute the parsed command line. Now would be a good time to take another look at main.c to see the high-level loop and logic for the entire shell. Although we have given you the necessary skeleton, most of the “work” for executing command lines is unimplemented. Your job is to fill it in:

Exercise 3. In cmdrun.c, implement cmd_line_exec() and cmd_exec(). The comments in cmdrun.c give specifications and hints.

It may be best to implement cmd_line_exec() first, and then to fill out cmd_exec() in pieces, testing the functionality as you go (using make test and your own testing).

Your functions will need to make heavy use of system calls. To learn more about the exact use of these system calls, you want to consult the manual pages. The interface to these pages is a program called man. Systems programmers need to type man a lot; you should too.

For example, man waitpid will give you documentation on the parameters and return values to waitpid(). Note that sometimes you will need to specify a section of the manual. For example, man open may not give you documentation on the system call open(); you would want man 2 open. Here is a list of some man commands that will be useful in this lab; you may need others:

# the numbers may be optional, depending on your system

$ man 2 waitpid # note WEXITSTATUS!

$ man 2 fork

$ man 2 open

$ man 2 close

$ man 2 dup2

$ man 3 strdup

$ man 3 strcmp

$ man 2 pipe

$ man 2 execve # or “man execvp” or “man 3 exec”

$ man 2 chdir

$ man 3 getcwd

$ man 3 perror

$ man 3 strtol

Interestingly, you don’t need to invoke read() and write() in this lab. (Why not?) You can learn more about the man program by typing man man (but avoid possible confusion).

A hint, concerning the exec variants: note that the argv array includes the command name itself as the “zeroth” argument. For example, in the command echo foo, the initial element in the array is argv[0], which is the address of memory that holds the string echo. And argv[1] is the address of memory that holds the string foo. This is not necessarily intuitive. A word about testing: if a particular test is giving you trouble, it may be helpful to type it into the standard shell (bash, as covered in the warmup earlier), and see what happens. Then play around with (or modify) the test, to try to understand what bash expects. That may give you insight about what your code is supposed to do.

Programming Homework Help

GMU Relationship Between Males or Females in A College Project

 

I have a question that should be answered through the dataset, and my two variables are already picked all at the top of the document. All the instructions are hopefully all attached in the document, let me know if anything else is needed from my end.

Programming Homework Help

Create an Imitation of The Famous Memory Game Simon Project

 

Overview

For this final project your goal is to create an imitation of the famous memory game Simon. The game consists of four colored LEDs and four push buttons. A round in the game consists of the device lighting up the LEDs in a random order. The player must reproduce that order by pressing the buttons associated with the LEDs. As the game progresses, the number of buttons to be pressed increases.

If you haven’t played the game before, check this site. (Flash player required)

In the process you will:

  • Review how to interface with push buttons.
  • Review how to debounce a push button.
  • Discover how to play sounds using a piezo buzzer.
  • Make use of arrays to store game data.
  • Make use of control and repetition structures for gameplay.
  • Implement your own LED chaser.
  • Create and make use of functions.

In the end, your system should look like the one presented below.

Simon

Functional Requirements

  • This imitation of Simon does not run forever. You are only required to generate ten rounds.
  • During a round the system must illuminate a number of LEDs. Each LED has an associated sound with it. For instance, in round one the system illuminates the red LED and plays the tone associated with that LED. In round two, the system illuminates two LEDs and plays the tones associated with those LEDs. Make sure to leave a second in between the light up of your LEDs.
  • After illuminating all LEDs for that round, the system must wait for the appropriate amount of button presses. For instance, round one should only accept one button press and round two should accept two button presses. The user’s button press will blink the LED once and play its associated tone. If at any point the player pushed a wrong button the game is over. If the player pushed all the buttons in correct order then it’s a win.
  • When the player wins (this is by pressing all the buttons correctly), the LEDs must exhibit a chaser or sequencer behavior. This should give the appearance of running lights and should be repeated indefinitely. If you are unsure what sequence to implement, you can check this link for some ideas.
  • Use the buzzer to make a sound when the player presses a button.
  • If the user pressed an incorrect button play an error sound, turn off all the lights, and wait indefinitely.
  • Whether it’s a win or a lose the game will only be restarted by pressing the reset button on the Arduino.
  • Make sure that on every game you get a different set of rounds.

Getting Started

  1. Download the starter file set. It will contain the following:
  • SimonStarter.ino
  1. Use your favorite IDE or editor to modify your files.
  2. Make use of the provided variables to complete your program. Add more if you feel you need to store additional data.
  3. Make sure to use functions to avoid repetition of source code.
  4. Add comments!
  5. Compile your program and play.

Technical Requirements

  • You are required to avoid copy-paste repetition of code at all costs. You must use functions, control, and repetition structures to achieve this.
  • You are required to use arrays to store game data.
  • You are required to use constants to avoid magic numbers. You should write code that can easily be extended to accommodate more LEDs.
  • You are required to create the functions digitalReadGeneric(), digitalWriteGeneric(), and pinModeGeneric(). These functions replace the Arduino’s digitalRead(), digitalWrite(), and pinMode() respectively. The function prototypes are provided below.
bool digitalReadGeneric(uint8_t pin);
void digitalWriteGeneric(uint8_t pin, bool isOn);
void pinModeGeneric(uint8_t pin, bool isOutput);
  • You are required to create the function delayGeneric(). This function replaces the Arduino’s delay(). The function prototype is provided below.
void delayGeneric(unsigned long ms);
  • Create a function of your own to handle the tone playing.
  • Use the following steps to generate the tone for the red LED:
    1. Play 440 Hz for 150ms
    2. Wait for 1136us
    3. Play 440 Hz for 150ms
  • Use the following steps to generate the tone for the yellow LED:
    1. Play 784 Hz for 150ms
    2. Wait for 638us
    3. Play 784 Hz for 150ms
  • Use the following steps to generate the tone for the blue LED:
    1. Play 587 Hz for 150ms
    2. Wait for 851us
    3. Play 587 Hz for 150ms
  • Use the following steps to generate the tone for the green LED:
    1. Play 880 Hz for 150ms
    2. Wait for 568us
    3. Play 880 Hz for 150ms
  • The following steps will generate an error-sound:
    1. Play 250 Hz for 250ms
    2. Wait for 250ms
    3. Play 150 Hz for 250ms

Programming Homework Help

MIS 610 GCU ApplicationAggregate Functions Worksheets

 

The purpose of this assignment is to examine the use of aggregate functions, analyze queries that contain NULL values, and use CASE logic to resolve the data and arrive at a solution.

For this assignment, you will perform a set of exercises in which you will analyze data and develop corresponding aggregate functions to obtain the required information. You will use Microsoft SQL Server and the content from the AdventureWorks databases, as directed by your instructor, to complete the assignment.

Please note that when SQL queries are run, results are generated in the form of data. This data should be exported and saved to Excel for a visual check of accuracy.

Create a Word document that includes the SQL queries used to explore the database tables, and answer the following questions.

Query Scenarios

Problem One

The sales manager asks you to provide the average “Pretax Sales” amount throughout the years. Using the “Sales.SalesOrderHeader” table, what answer will you provide to the sales manager?

Problem Two

As part of an internal competition, the CEO requests that you provide the name of the employee who made the highest total single sale in 2014. This data needs to include the filter “Tax & Freight” using “OrderDate” for the year. The CEO has also requested that you provide the winner’s e-mail address so he can send a notification of congratulations.

Problem Three

Jo Berry’s manager indicated that Jo was taking paid time off this month. He wants to ensure the system reflects this information. Import the “Hours” spreadsheet file, located in Course Materials, into the AdventureWorks database. Add Jo Berry’s hours together for the month, and title the field “Monthly Hours.” Use the knowledge you have learned about NULL values to provide the solution to the manager.

Problem Four

The human resources manager wants to classify employees who were absent during the entire month as “Inactive.” Using a CASE statement, write a query that classifies employees as “Active” or “Inactive” in a column titled “Status” with “Full Name” (First and Last) also listed.

Problem Five

Using the same parameters as Problem Four, rewrite the query to provide only the list of “Inactive” employees.

General Requirements

Programming Homework Help

Car Dealership Revenues from Online Sales Program

 

Write a program to find the revenue from online sales for a car dealership.

The dealer enters the car price (excluding tax) and how many cars were sold to customers.

The program calculates the tax to be paid by the customer (9% per car).

The online sale for the car dealership is the sum of the car cost  to customer for all cars sold, including the tax for all cars sold.

You must display the amount for the car sales (include the car price and tax per car paid by the customer) at the end of the program.

  1. Use Visual Studio 2019  or any other I just need the code to copy it

Programming Homework Help

Cuyahoga Community College Create a Program Code C Programming Task

 

This draft of your final report will have all the elements of your final report with some missing final details and code that will be filled in later. See the final report assignment description for the list of items that must be included in that report – each of the items must be included in outline form (at least a one-line place holder for each item that is not complete).

HOWEVER this submission should include a substantial portion of your final project code!

This submission must include:

  1. A declaration that the work you’re submitting is your own original work except where explicitly marked otherwise and cited
  2. A high level description of your program
  3. A list of the core functions and operations of your project, plus any optional features/functions to be added later
  4. A high level description of the code, written in C or pseudo code or flow chart format
  5. Summary of the tests you’ve performed on your MIPS code and screen shots showing the test results
  6. Summary of the remaining tasks to be completed before the final report is due
  7. At the end of the draft report, you must include ALL the C and MIPS code you’ve written to date, pasted into the report file

Submit the current version of your code in .C and .asm file(s).

Your C and MIPS code should compile/assemble and execute without errors, even if it isn’t fully functional.

It must include the basic structure of your final project, written in C and MIPS assembly code with comments and stub code (empty, like prototype functions) that define arguments and return values. I/O and other features that are not complete can be faked by using scanf/printf, initialized variables, strings, arrays, etc.

This report and code should grow as you work on your project and become the high level definition and pseudocode of your final project’s MIPS assembly code. By the time you complete the MIPS code, it must embody the basic logic and algorithms described above.

Filling in the missing pieces and finalizing your code should be the only things you need to add to this report to become your final project report.

Programming Homework Help

AIUO Arrays

 

Develop a C# console application that implements an int array. Use 2 ‘for’ loops, the first to fill the array using the Random class to generate random integers (see p241, section 7.9) using the next method of the Random class and a second for loop to iterate through the filled array and print the values entered into the array by the random number generator. Use the array’s length variable to stay within the array bounds for both loops.

Possible output might look like this:

The array value is 488
The array value is 402
The array value is 237
The array value is 48
The array value is 390
The array value is 186
The array value is 425
The array value is 342
The array value is 477
The array value is 319
Press any key to continue .

Programming Homework Help

CMIT 421 University of Maryland VM Scanner Evaluation Background Report

 

You should link your analysis to the kinds of organizational functions and data associated with a transportation company (e.g., protecting order data, customer lists, sales leads, Payment Card Industry (PCI) compliance for processing credit, proprietary software, etc.) and provide your recommendation if Mercury USA should purchase the Nessus tool. This report should be four to six pages in length and include a title/cover page. Include in-text citations and a reference page with three quality sources in a citation style of your choice.

https://learn.umgc.edu/content/enforced/602243-027…

For this assignment, you are asked to provide your supervisor, Judy, with a technical evaluation of a vulnerability scanner. By documenting your results in an effective background report, you are showing how you use your technical knowledge to convey your ideas to others in a professional setting. Your ability to express your findings using the right mix of technical detail in a business context is an important workplace skill.

The following evaluation criteria aligned to the competencies will be used to grade your assignment:

  • 1.3.1: Identify potential sources of information that can be used to develop and support ideas.
  • 1.4.1: Produce grammatically correct material in standard academic English that supports the communication.
  • 10.1.1: Identify the problem to be solved.
  • 12.2.1: Identify systems for the risk assessment.
  • 12.3.1: Select controls.
  • 13.2.1: Evaluate vendor recommendations in the context of organization requirements.