C++ programming question will upvote

![Enter the radius of the circle: [3.5] A circle of radius 3.5 has an area of: 38.4845 and a circumference of: 21.9911 Press an](http://img.homeworklib.com/images/195c1ec9-5214-4828-926b-4f033523e90c.png?x-oss-process=image/resize,w_560)


I have done both this problems. I hope that you wanted it.if you need further help please let me know. I have added comments where it necessary. If you still have problem please let me know by leaving comments.
Program for area calculation------------------------------------
#include<iostream>
using namespace std;
/*Function prototypes*/
double getRadius();
double findArea(double);
double findCircumference(double);
int main(){
double radius;
double area;
double circumference;
radius=getRadius(); /*calling getradius function which
takes input from user*/
area=findArea(radius);/*calling find area function
which calculate area of circle*/
circumference=findCircumference(radius);/*calling
findcircumference function which calclate circumference*/
cout<<"A circle of radius
"<<radius<<" has area of:
"<<area<<endl;/*endl for new line*/
cout<<"and a circumference of:
"<<circumference<<endl;
system("PAUSE");
return 0;
}
double getRadius(){/*radius has double data type thats why return
type should be double*/
double radius;/*local radius variale which hold the
value from user and it returns a valule to main progrm*/
cout<<"Enter the Radius of Circle: ";
cin>>radius;/*Reading input from user*/
return radius;/*Returning radius to main
program*/
}
double findArea(double radius){ /*findArea function takes
parameter radius and calculate area and reutrun value to main
function, over here return type is double because area's data type
is double*/
double area; /*local area variale which hold the value
of area(calculation) and it returns a valule to main progrm*/
area=3.14159*radius*radius;/*calculating
area*/
return area;/*Returning area to main function*/
}
double findCircumference(double radius){
double circumference; /*local circumference variale
which hold the value of circumference(calculation) and it returns a
valule to main progrm*/
circumference=2*3.14159*radius; /*calculating
circumference*/
return circumference; /*returning circumference to
main program*/
}
Program for net pay-----------------
#include<iostream>
#include<iomanip>
using namespace std;
void printDescription();
void computePaycheck(float,int,float&,float&);
int main(){
float payRate;
float grossPay;
float netPay;
int hours;
cout<<setprecision(2)<<fixed;/*to
represent floating point number upto 2 decimal point with fixed
notation*/
cout<<"Welcome to the PayRoll
Program"<<endl;
printDescription();
cout<<"Please input the pay per
hour"<<endl;
cin>>payRate; /*Reading input payrate*/
cout<<endl<<"Please input the number of
hours worked"<<endl;
cin>>hours;/*Reading input hours*/
cout<<endl<<endl;
computePaycheck(payRate,hours,grossPay,netPay);/*calling compute
paycheck in which two parameter payrate and hours are passed by
value while gross pay and netpay variale are pass by referance(or
in aother words we are passing address of grossPay and nrtpay
variable hence any change made in this variable in called function
reflacted in main)*/
cout<<"The gross pay is:
$"<<grossPay<<endl;/*printing gross pay*/
cout<<"The netpay is:
$"<<netPay<<endl;/*printing net pay*/
}
void printDescription(){/*Just display function*/
cout<<"***************************************************************"<<endl<<endl;
cout<<"This program takes two numbers (Payrate
& hours )"<<endl;
cout<<"and multiplies them to et gross
pay"<<endl;
cout<<"it than calculate net pay by substracting
15%"<<endl;
cout<<"***************************************************************"<<endl<<endl;
}
void computePaycheck(float rate,int hours,float& gross,
float& net){/*function defination in which rate=payrate and
hours=hours, while gross is alias to Grosspay it looks like
(float& gross= grossapay hence gross and grossPay referes to
same address hance any change made into gross reflacted in
grossPay, simmilary for net*/
gross=rate*hours;/*calculating gross pay by
multiplying rate/hours and hours*/
net=0.85*gross;/*net pay is 15% less what he/she
earned hence (1-0.15=0.85) and multiplying with gross pay*/
}


A) One of the problems that have been discussed in the class is to write a simple C++ program to ...
A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following: int main() { double radius; double area; double circumference; //the radius...
Need C++ Code (Please put //comments on there too) 1. Complete the following code: Design a class called Circle. The class should have an integer member variable named radius and three member functions; setRadius, getRadius, calArea; the functions' prototypes should be done inside the class declaration and the functions' definitions should come after the main function #include <iostream> using namespace std; const double PI = 3.14; // fill in the declaration of the class Circle here int main() { Circle...
Exercise 2: There can be several constructors as long as they differ in number of parameters or data type. Alter the program so that the user can enter just the radius, the radius and the center, or nothing at the time the object is defined. Whatever the user does NOT include (radius or center) must be initialized somewhere. There is no setRadius function and there will no longer be a setCenter function. You can continue to assume that the default...
Given the following program, which line(s) cause(s) output to be displayed on the screen? 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 #include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 int hours; 9 double payRate, grossPay; 10 11 hours = 40; 12 payRate = 20.0; 13 grossPay = hours * payRate; 14 cout << "My gross pay is $" << grossPay <<...
Write a C program named assignment04.cpp that will ask for and read in a float for a radius ask for and read in a float for the height each of the following functions will calculate some property of a shape (area, volume, circumference, etc) The functions will accept one or two parameters (radius and/or height) and return the proper calculation. There is no input/output (cin or cout) in the function – just the calculation write the following functions float areaCircle(float...
modify sample code from example two to calculate the surface area
and volume of a sphere givin the radius
int main() Example 2 Introduction to structures and passing the structure variables as arguments into functions. 1. A structure is created with circle related variables. 2. Two functions are created related to circle calculations. 3. This example passes structure variables from the main function to the message Circle function 4. The message Circle function converts the structure variables into regular double...
Using the code below (C++), add a struct with only 1 vector #include #include #include // Needed to define vectors using namespace std; int main() { vector hours; // hours is an empty vector vector payRate; // payRate is an empty vector int numEmployees; // The number of employees int index; // Loop counter // Get the number of employees. cout << "How many employees do you have? "; cin >> numEmployees; // Input the payroll data. cout << "Enter...
C++ 8. Circle Class 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...
c++ Please help! i keep getting an error message. I think my
main problem is not understanding the circle calculations function
and how both the area and the circumference is returned from the
function. I know & needs to be used, but I am unsure how to use
it.
Copy the following code and run it. You should break it into the following 3 functions getValidinput - which asks the user to enter the radius and then make sure that...
#include <iostream> using namespace std; class Circle{ // private member variable named radius private: double radius; // get function for radius public: double getRadius(){ return radius; } // set function for radius void setRadius(double rad){ radius=rad; } // returning area = 3.14159 * radius * radius double getArea(){ return (3.14159 * radius * radius); } }; // Sample run int main() { // Declaring object of Circle Circle myCircle; myCircle.setRadius(5); // printing radius of circle cout<<"Radius of circle is: "<<(myCircle.getRadius())<<endl;...