C Programing Write A Macro For Each Of The Following Computer Science Homework Help

1)  Write a macro foreach of the following.  DO NOT provide a function

  a) Area of aCircle

  b) Area of aSquare

  c) Area of aRectangle

  d) Area of aTriangle

  You can findformulas and detailed explanations at: http://www.mathisfun.com

2)  Write a function which will determine how manywords are in a given string.  You canassume that one or more consecutive white spaces is a delimiter between words,and that the string you pass to your function is null terminated.

3)  Write a functionthat is passed a month, day, and year and will determine if that date isvalid.  You can assume each parameter ispassed in as an integer.

  Remember to checkfor leap year!

  validDate(5, 31, 1961)  …. would be valid

  validDate(13, 4, 1967)  … would be invalid,the month is invalid

4)  Write a functionthat takes the values of a two-card blackjack HAND as input, and returns thepoint total of the hand. The value of the cards ‘2’ through ‘9’ is equal totheir face value, the cards ‘T’, ‘K’, ‘Q’, ‘J’ are worth 10 points and the ace(‘A’) is worth 11 points unless it comes with another ace, then that second aceis worth 1 point. The program should be able to catch incorrect input.

  Enter cards: AQ 

  The scoreis 21

  Enter cards: AA 

  The scoreis 12

  Enter cards: T7 

  The scoreis 17

  Enter cards: A5 

  The scoreis 16

  Enter cards: 7# 

  *** Wouldbe invalid, # is not a valid card

  Enter cards: Z4 

  *** Wouldbe invalid, Z is not a valid card

  Hint:  I’ve used a value of ‘T’ for the 10 card soyou can simply pass in two characters,

 instead of strings, as parameters to this function.

  5) Write a functionto determine is a given word is legal. A word is illegal if it contains no vowels. For this problem, the letterY is considered to be a legal vowel. Pass in a word to this function and it will determine if the word is legalor not.  You can make the following assumptionsabout the word you a passing to this function.

  1) The stringbeing passed is a combination of letters only (no non-letter check needed)

  2) The stringbeing passed is null terminated

  3) Lettersmay be capital or lower case and it has no effect on whether its a word

 Examples: 

 sch  – is illegal, no vowels 

  apple- legal, contains a vowel

  APPle- legal, uppercase letter combinations do not matter 

  try -legal, no vowel, but contains the letter ‘y’

6)  Write a functionthat will determine if a given string is a palindrome.  DO NOT use the C library function: strrev

  A palindromeis a word or sentence that reads the same forward as it does backward.

  Examples ofword palindromes would be civic or rotor … a word or phase would be:

  Neverodd or even

  A good website of examples is:  http://www.rinkworks.com/words/palindromes.shtml

7)  Write a functionthat will return in a structure the following characteristics of a givenstring: 

  1) stringlength (use strlen), 

  2) number ofupper case characters

  3) number oflower case characters, 

  4) number ofdigits

  5) number ofblank spaces

  6) number ofnon-alphanumeric characters.

8)  Develop a set offunction(s) to compute various offensive statistics on baseball.  The following information will be availableon each player:

  Number ofWalks (BB), Strike Outs (SO), Hit by Pitch (HP), Sac Flys (SF), Singles,

  Doubles(2B), Triples (3B), and Home Runs (HR) as well as Number of At Bats (AB).

  Based on thisinformation, develop a set of functions that will compute the following:

  Total Bases,Batting Average, Home Run Ratio, Strike Out Ratio, On Base Percentage, andSlugging Average.

  You do not needto be a baseball fan to do this … All the information you need in terms ofthe formulas and explanations can be found at:

 http://www.baseball-almanac.com/stats.shtml

  Note:  Number of hits is:  singles + doubles + triples + home runs

  If you want totest if your functions are working, see compiled stats of the 2014

  Boston Red Soxat: http://www.baseball-reference.com/teams/BOS/2014.shtml

  Note:  All I am looking for here is a set offunctions … you do not need to put them into a program and show me how youcall them, i.e., no main function needed.

9)  Most people enjoywatching movies these days, whether its the classics or modern ones. 

  Develop a set ofstructures that could be used to model the information about a moviecollection. 

  What type ofinformation would you want to collect and store about a movie?  What would be the right types in C for thatinformation?  Define supportingstructures as needed and have one final structure type that is made up ofvarious members (some members may be on some structure type, others may besimple integers, floats, chars, arrays, etc). 

  No program isneeded although you might want to create a simple main function and includeyour structure types just to test that everything compiles. 

  /* addsupporting structures – expect many structure types here … date is goodexample */

  struct date

  {

  int month;

  int day;

  int year;

  };

  /* add othersupporting structures */ 

  /* Finalstructure, such as struct movie */

  struct movie

  {

  /* somemembers may be a structure type themselves, here is an example */

  structdate releaseDate;  /* the date the moviewas released */

  /* othermembers may be ints, floats, doubles, chars, enum, …  */

  char title [100];  /* the title of the move */

  /* addothers */

    };

  int main  (  )

  {

  structmovie myMovie [1000]; 

  /*nothing else needs to be added to main */

  return(0);

  };

No matter what kind of paper writing service you need, we’ll get it written. Place Your Order Now!
× How can I help you?