Eastern Michigan University C++ Arrays and Pointers Project

Eastern Michigan University C++ Arrays and Pointers Project

Hello, please answer the below questions. I am looking for someone to start full time help so if you answer the qestions well I will become a regular! I will tip well for an A+ job!

1) Write a program that uses the MovieData class you defined in 7.8a. The program prompts “movie information: ” and then reads the title, director, release year and running-time, each typed on a line by itself. The program then creates a MovieData object and uses the object to print the movie information.

Here is one sample run:

movie information: Casablanca_x000D_
_x000D_
Michael Curtiz_x000D_
_x000D_
1942_x000D_
_x000D_
102_x000D_
_x000D_
Casablanca (1942). Directed by Michael Curtiz. (102 minutes)_x000D_

Note: Do not define the class here– just write the program that uses it.

2) Write a program that uses the Date class you defined in 7.1a. The program prompts “date information: ” and then reads three integers: the date, the month and the year. The program then prints the date three times, each time on a line by itself. The first time the date is in numerical format, the second in month-first format, and the third time in date first format.

Here is one sample run:

date information: 15 3 2014_x000D_
_x000D_
3/15/2014_x000D_
_x000D_
March 15, 2014_x000D_
_x000D_
15 March 2014_x000D_

Note: Do not define the class here– just write the program that uses it.

3) Rainfall Statistics

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display (in this order):

  • the total rainfall for the year,
  • the average monthly rainfall,
  • and the months with the highest and lowest amounts.

Months should be expressed as English names for months in the Gregorian calendar, i.e.: January, February, March, April, May, June, July, August, September, October, November, December.

Input Validation: Do not accept negative numbers for monthly rainfall figures. When a negative value is entered, the program outputs “invalid data (negative rainfall) — retry” and attempts to reread the value.

NOTE: Decimal values should be displayed using defaultprecision, i.e. do not specify precision.

4) Monkey Business

A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 7 array, where each row represents a different monkey and each column represents a different day of the week. The monkeys are represented by integers 1, 2, and 3; the weekdays are “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”. The program should first prompt the user to input the data for each monkey, starting with “Sunday” for monkey #1, then monkeys #2 and #3, followed by “Monday” for monkey #1, then monkeys #2 and #3 and so on, through “Saturday”. The program then creates a report that includes the following information, each properly labeled (see below):

  • Average amount of food eaten per day by the whole family of monkeys.
  • The least amount of food eaten during the week by any one monkey.
  • The greatest amount of food eaten during the week by any one monkey.

Input Validation: Do not accept negative numbers for pounds of food eaten. When a negative value is entered, the program outputs “invalid (negative) food quantity — re-enter” and attempts to reread the value.

NOTE: Decimal values should be displayed using defaultprecision, i.e. do not specify precision.

5) Monkey Business

A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 7 array, where each row represents a different monkey and each column represents a different day of the week. The monkeys are represented by integers 1, 2, and 3; the weekdays are “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”. The program should first prompt the user to input the data for each monkey, starting with “Sunday” for monkey #1, then monkeys #2 and #3, followed by “Monday” for monkey #1, then monkeys #2 and #3 and so on, through “Saturday”. The program then creates a report that includes the following information, each properly labeled (see below):

  • Average amount of food eaten per day by the whole family of monkeys.
  • The least amount of food eaten during the week by any one monkey.
  • The greatest amount of food eaten during the week by any one monkey.

Input Validation:

  • Do not accept negative numbers for pounds of food eaten. When a negative value is entered, the program outputs “invalid (negative) food quantity — re-enter” and attempts to reread the value.

Prompts And Output Labels:

  • Decimal values should be displayed using defaultprecision, i.e. do not specify precision.
  • Each item read should be prompted for by a stringof the form “Enter the food eaten by monkey #N on DAY: ” when N is 1 or 2 or 3 and DAY is “Sunday” or “Monday” or … or “Saturday”.
  • The output should be of the form:
    Average food consumed daily: 6.23.
    The least daily food consumed was by monkey #0 on Friday.
    The most daily food consumed was by monkey #2 on Sunday.
    where the specific amount of food or specific monkeys or specific days identified depend on the actual input.

6) Define a PayRoll class that has data members for an employee’s hourly pay rate (an integer, representing cents) and number of hours worked (also an integer). The class provides two member functions, setRate and setHours that assign the value of their parameter to the appropriate data member. The class provides a third member function, getPay, that returns weekly gross pay (in cents), computed as follows: hours times rate for the first 35 hours plus hours times rate times one and a half for any hours past 35.

7) Tic-Tac-Toe

Write a program that allows two players (player X and player O) to play a game of tic-tac-toe. Use a two- dimensional char array with three rows and three columns as the game board. Each element of the arrayshould be initialized with an asterisk (*). The players take turns making moves and the program keeps track of whose turn it is. Player X moves first. The programshould run a loop that:

  • Displays the contents of the board array (see prompts and output, below).
  • Prompts and allows the player whose turn it is to select a location on the board for an X in the case of player X or an O in the case of player O. The program should ask the player to enter the row and column number. Valid row or column numbers are 1, 2, or 3.

The loop terminates when a player has won, or a tie has occurred. If a player has won,
the program should declare that player the winner and end. If a tie has occurred, the program should say so and end.

Player X (O) wins when there are three Xs (three Os) in a row on the game board. The Xs (Os) can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.

Input Validation: The program should check the validity of the row and column numbers entered by the players. To be valid, the row and column number must refer to an unoccupied position in the game board. When an invalid entry is made, the program simply redisplays its most recent prompt and attempts to reread the value.