1. Engineering
  2. Computer Science
  3. computer science ii func assignment 4 write a c...

Question: computer science ii func assignment 4 write a c...

Question details

Computer Science II – func. assignment #4

Write a C program that has 1 function:

  1. accepts as parameters two ints (row and column)
  2. evaluates the row and column and determines if the row and columns numbers would be on a checker board.
  3. In other words, are the row and column numbers greater than or equal to 0 and less than or equal to 7
  4. Are the row and column numbers contained on an 8X8 array
  5. Return true if the row and column numbers are in the array else return false

function headers should be:

bool evaluateRowCol(int row, int col)

in main

  1. ask for the row and column numbers
  2. read in the row and column numbers numbers
  3. call your function                                                    bool evaluateRowCol(int row, int col)
  4. output in main should be

          row          ?

          column    ?

          is on the checker board

                      or

          is not on the checker board

Use the output (cout) manipulators to format the output correctly [setw(?), fixed, right, left, etc]

Second part

Write a C program named second that will

  1. ask for and read in a float for a radius
  2. ask for and read in a float for the height
  3. each of the following functions will calculate some property of a shape (area, volume, circumference, etc)
  4. The functions will accept one or two parameters (radius and/or height) and return the proper calculation.
  5. There is no input/output (cin or cout) in the function – just the calculation
  6. write the following functions
    1. float areaCircle(float radius)

where the area of a circle is calculated by

                area = PI * radius * radius

  1. float circumCircle(float radius)

where the circumference of a circle is calculated by

                circumference = PI * radius * 2

  1. float areaCylinder(float radius, float height)

where the area of a cylinder is calculated by

                area = 2 * PI * radius * radius + height * PI * radius * 2

  1. float volumeCylinder(float radius, float height)

where the volume of a cylinder is calculated by

                volume = PI * radius * radius * height

  1. float volumeCone(float radius, float height)

where the area of a cylinder is calculated by

                volume = (1 / 3) * (PI * radius * radius * height)

                All input and output (cin and cout) are in maim()

in main()

  1. get the radius and height
  2. call each of the functions and print out the answer
  3. output should look like

radius is ??????

height is ??????

area of the circle is                                ????????

circumference of the circle is ????????

area of the cylinder is                           ????????

volume of the cylinder is      ????????

volume of the cone is                           ????????

must be answer both part

and code not suppue to be copy anyone els

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution