Expert answer:C programming Midterm

Solved by verified expert:Im just too far behind so I need help.
the_c_midterm.pdf

Unformatted Attachment Preview

C Programming Midterm
Directions:
This is the midterm for the C Programming Class.
Answer electronically the questions and submit them into BlackBoard Learn by the Due Date.
Answer all questions and follow the rules below.
Please attach one single text file (not Word or other formats) with all your answers.
– Name your submitted file using the following format: [Your Last Name]_midterm.txt
… so if you last name was Jones, your submitted file would be called: Jones_midterm.txt
Do not send multiple files!
I just need the answer … do not send program output, only the C source code … and again, all in one single text file.
Understand that if I ask for a function, all I am looking for is that function in your answer … not a complete program that includes a main function … I just need to see
your function as the answer.
If I ask for a program, then I am looking for a main function that calls one or more functions (include the functions).
If I ask for a code segment, then all I am looking for is just the code needed to answer the question.
Rules:
1.
2.
3.
4.
5.
6.
You many use your book and notes
Quality, Re-usability, Maintainability, Readability, and Efficient code will be stressed in addition to correctness.
Same rules and standards apply as your homework assignments (comments, headers, style, …)
Use your computer to compile your code and test it out
Don’t converse with other students or friends
Contact me if you have questions or state your assumptions
Questions:
1) Use the link below for the background needed to create two functions that work with a Trapezoid
http://www.mathsisfun.com/geometry/trapezoid.html
a) Write a function that will return the area of a trapezoid
b) Write a function that will return the perimeter of a trapezoid
2) Write a function
int frequency (int theArray [ ], int n, int x)
that counts the number of times the item x appears among the first n elements of theArray
and returns that count as the frequency of x in theArray.
Use integers for everything!
For example, if the array being passed contained the values
5, 7, 23, 8, 23, 67, 23
… and n was 7 and x was 23, then it would return a value of 3 since 23 occurs 3 times within
the first 7 elements of the array.
3a) (Function) Represent the mathematical operation: max (x, y, w, z) as a C function.
This is, write a function that is
passed 4 integer values that returns the largest value of those four parameters. For example, max (5, 2, 4, 1) would
return 5 since it is the largest value of the four parameters.
3b) (Code Segment) Rewrite the mathematical operation:
operator. For example, max (x, y) would be:
max (x, y, w, z) as a single statement using the conditional expression
max = (x > y) ? x : y;
Hint: You will have more than one conditional expression operator (?) in your answer, and it would
help to use boolean logic operations that were covered in Week 3.
4)
Given the following test scores and grade equivalents, write a function
which is passed a score, and returns a letter grade based on
the score entered. It should also check for invalid values (a number less than 0 or greater than 100).
Score
—–90-100
80-89
70-79
60-69
Grade
—-A
B
C
D
0 -59
F
5) Write a function that is passed an array of characters containing letter grades
from our previous question, and prints a report that shows the total number
of occurrences of each letter grade.
Your function should accept both lower
and upper case grades, for example, both ‘b’ and ‘B’ should be bucketed into
your running total for B grades.
Any grade that is invalid should be bucketed
as a grade of ‘I’ for Incomplete.
You must use a switch statement, and your function should accept an array of any size.
Feel free to pass in the array size as parameter so you know how many grades you’ll
need to check in your loop.
For example, if you passed a function the following array:
char grades [ ] = {‘A’, ‘b’, ‘C’, ‘x’, ‘D’, ‘c’, ‘F’, ‘B’, ‘Y’, ‘B’, ‘B’, ‘A’};
It would print:
Grade
—-A
B
C
D
F
I
Total
—-2
4
2
1
1
2
6) Write a program that contains a main function and three other functions that
will return various attribute information about an array of floating point
numbers:
array_sum – total sum of all array elements
array_avg – average of all array elements
array_min – the smallest number of the array elements
The main function should print the values returned from each function at the
end of the program.
7) Write a function that raises an integer to a positive integer power.
Call the function x_to_the_n, taking two integer arguments x and n.
Have the function return a long int, which represents the results of
calculating x to the nth power.
Do not use the C pow library function.
Example:
NOTE:
if x = 3 and n = 2, the function would return 9.
Do not use recursion (since that version is in your lecture notes).
8) (Code Segment) The Federation has asked you to develop a program to keep track of its
officers. A sample of the kind of information for each officer is
shown below.
Name: Mr. James Tiberius Kirk
Date of Birth: March 22, 2233
Address: 23 Falling Rock,
Riverside, Iowa 52327-0021
Planet Earth
Rank: Captain
Ship: USS Enterprise
Nickname: Jim
Starfleet ID: 02341232
Hourly Pay: 456.78
Favorite Saying: “Bones???”
Starting Stardate: 41153.7
Martial Status: Single
Starfleet Graduation Date: June 23, 2212
Name: Mr. Leonard A. McCoy Jr.
Date of Birth: 7/8/2227
Address: 8745 South Road
Jackson, Mississippi 09201-0001
Planet Earth
Rank: Chief Medical Officer
Ship: USS Enterprise
Nickname: Bones
Starfleet ID: 00034212
Hourly Pay: 234.56
Favorite Saying: “He’s dead Jim.”
Starting Stardate: 41151.8
Marital Status: Divorced
Starfleet Graduation Date: June 21, 2210
Provide the code need to DECLARE an array of structures given the above
information. Don’t write a program and don’t worry about initializing
the structure based on the information above.
Be careful on how you declare the members of a structure. Grading
will be based on how the flexibility of your design (i.e., define many
structures and have structures within structures if necessary).
Note:
Don’t go overboard such as having a structure with only one member
just to create many structures.
9) What compiler do you use in this class?
Your Compiler:
4 Likes and/or Dislikes:
1)
2)
3)
4)
Give me four things you like and/or dislike about our compiler … any combination will work.

Purchase answer to see full
attachment

How it works

  1. Paste your instructions in the instructions box. You can also attach an instructions file
  2. Select the writer category, deadline, education level and review the instructions 
  3. Make a payment for the order to be assignment to a writer
  4.  Download the paper after the writer uploads it 

Will the writer plagiarize my essay?

You will get a plagiarism-free paper and you can get an originality report upon request.

Is this service safe?

All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 20% with the discount code ESSAYHELP