Question
I need help with my programing lab (please make it really simple). Thaks 1-Write a Circle class that has the following member variables: radius: a
I need help with my programing lab (please make it really simple). Thaks
1-Write a Circle class that has the following member variables: radius: a double pi: a double initialized with the value 3.14159 The class should have the following member functions: Default Constructor. A default constructor that sets radius to 0.0. Constructor. Accepts the radius of the circle as an argument. setRadius. A mutator function for the radius variable. getRadius. An accessor function for the radius variable. getArea. Returns the area of the circle, which is calculated as area = pi * radius * radius getDiameter. Returns the diameter of the circle, which is calculated as diameter = radius * 2 getCircumference. Returns the circumference of the circle, which is calculated as circumference = 2 * pi * radius Write a program that demonstrates the Circle class by asking the user for the circles radius, creating a Circle object, and then reporting the circles area, diameter, and circumference.
2- Design a class that has an array of floating-point numbers. The constructor should accept an integer argument and dynamically allocate the array to hold that many numbers. The private data members of the class should include the integer argument in a variable to hold the size of the array and a pointer to float type to hold the address of the first element in the array. The destructor should free the memory held by the array. In addition, there should be member functions to perform the following operations: Store a number in any element of the array Retrieve a number from any element of the array Return the highest value stored in the array Return the lowest value stored in the array Return the average of all the numbers stored in the array Demonstrate the Class in a Program
3- Design a PayRoll class that has data members for an employees hourly pay rate, number of hours worked of type double. The default constructor will set the hours worked and pay rate to zero. The class must have a mutator function to set the pay rate for each employee and hours worked. The class should include accessors for both the hours worked and the rate of pay. The class should lastly have a getGross function that will return a double calculated by multiplying the hours worked by the rate of pay. Write a program with an array of seven PayRoll objects. The program should ask the user for the rate of pay for each employee and the number of hours each employee has worked. Be sure to include an employee claiming to work more then 60 hours per week. Print out, the array number of the employee, the hours worked, the rate of pay, and the gross pay, of all the employee's each on their own line. Set the precision for printing the doubles to two decimal places. Input Validation: Do not accept values greater than 60 for the number of hours worked, simply have the set function set number of hours worked to 60, the maximum allowed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started