Programming Homework Help

Programming Homework Help. Montana State University Bozeman C Programming Lab Report

 

You are to write a program that will read the names of hurricanes that affected Florida, their categories, and their date from the file lab4/hurricanes.csv.

You will write the list sorted by name to a file. Only print the number of the category, not the whole phrase that is in the file for category. For example, the first hurricane info line you print to your file should look like

Agnes     1    19-Jun,1972

REQUIREMENTS

  • Write your program in a file called lab4.c
  • Your output formatting must match the example. Use a tool like diffchecker to compare the content of your output file with the sample output. You do not need to worry about trailing spaces.

HINTS

  • In previous labs, we have used tabs (t) to space our output. For this assignment, you may want to use padding instead. For example, if the character array var held Colorado , printf("%10s", var) would print Colorado , so that the output took up exactly 10 characters. To print Colorado (with the spaces on the right, we could do printf("%-10s", var).
  • Consider structuring your program like so: store each line in an array of strings. Sort it. (Or sort an array of pointers to strings in your original array.) Then use strtok only when you go to print out the lines in sorted order

———————————————————————————————————————————————————

  • comments explaining what your program does
  • indent your code so it is readable
  • compiles successfully with -Wall – no warnings
  • does not use globals
  • successfully reads from file in same directory as your program
  • prints to a file in a pleasing manner and shows all the information
  • uses fgets to read in each line
  • stores each line in an array of strings
  • sorts the array
  • prints only the category number
  • uses at least 2 functions plus main
  • points – matches the sample output formatting exactly

Programming Homework Help

Programming Homework Help

Programming Homework Help. ENTD 220 APUS WK 7 A Class that Contain Prior Functions Program

 

You are going to enhance the prior assignment by doing the following

1) Create a class that contain prior functions

Lower Range/Upper range check

Add, Subtract, Multiply, Divide

The scalc function (it passes in two numbers and an operator)

Create a dictionary of key-value pairs. E.g., user entered 5, and 2: {“add”: 7, “sub” : 3, “mult”: 10, “div”: 2.5}

2) Test the application

     Be sure all components work as designed. Display the output from each function

Programming Homework Help

Programming Homework Help

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

Programming Homework Help

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

Programming Homework Help

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

Programming Homework Help

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

Programming Homework Help

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