7 kyu

Building Spheres

2,322 of 3,070NaMe613

Description:

Now that we have a Block let's move on to something slightly more complex: a Sphere.

Arguments for the constructor

radius -> integer or float (do not round it)
mass -> integer or float (do not round it)
radius -> integer
mass -> integer

Methods to be defined

get_radius()       =>  radius of the Sphere (do not round it)
get_mass()         =>  mass of the Sphere (do not round it)
get_volume()       =>  volume of the Sphere (rounded to 5 place after the decimal)
get_surface_area() =>  surface area of the Sphere (rounded to 5 place after the decimal)
get_density()      =>  density of the Sphere (rounded to 5 place after the decimal)
GetRadius()       =>  radius of the Sphere
GetMass()         =>  mass of the Sphere
GetVolume()       =>  volume of the Sphere (a double rounded to 5 place after the decimal)
GetSurfaceArea()  =>  surface area of the Sphere (a double rounded to 5 place after the decimal)
GetDensity()      =>  density of the Sphere (a double rounded to 5 place after the decimal)

Example

ball = Sphere(2,50)
ball.get_radius() ->       2
ball.get_mass() ->         50
ball.get_volume() ->       33.51032
ball.get_surface_area() -> 50.26548
ball.get_density() ->      1.49208
Sphere ball = new Sphere(2,50)
ball.GetRadius() ->       2
ball.GetMass() ->         50
ball.GetVolume() ->       33.51032
ball.GetSurfaceArea() ->  50.26548
ball.GetDensity() ->      1.49208

Any feedback would be much appreciated

Object-oriented Programming
Fundamentals

Similar Kata:

Stats:

CreatedAug 5, 2015
PublishedAug 5, 2015
Warriors Trained4574
Total Skips188
Total Code Submissions9249
Total Times Completed3070
Python Completions2322
C# Completions774
Total Stars61
% of votes with a positive feedback rating91% of 454
Total "Very Satisfied" Votes382
Total "Somewhat Satisfied" Votes58
Total "Not Satisfied" Votes14
Total Rank Assessments79
Average Assessed Rank
7 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • NaMe613 Avatar
  • Blind4Basics Avatar
  • hobovsky Avatar
  • __eloise__ Avatar
  • saudiGuy Avatar
Ad