,

[SOLVED] Cs150 – lab 22

$25

File Name: Cs150_____lab_22.zip
File Size: 150.72 KB

Categories: , Tags: ,
5/5 - (1 vote)

Create a program that defines a class called circle. Circle should have a member
variable called radius that is used to store the radius of the circle. Circle should also
have a member method called calcArea that calculates the area of the circle using the formula area = pi*r^2. Area should NOT be stored in a
member variable of circle to avoid stale data.
Use the value 3.14 for PI.
For now, build everything in one file (main.cpp), make radius public and access radius directly using the dot operator. Do not worry about input validation for now. In main instantiate two objects of class circle and have the user enter a radius for each. Store the radii in the appropriate objects’ member variables, then print the radius and area of each circle using the member variable and function.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cs150 – lab 22[SOLVED] Cs150 – lab 22
$25