Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C + + program to compute the volume of a sphere ( Note: V = 4 3 pi r 3 ) .
Write a C program to compute the volume of a sphere Note: V
pi r
Define pi as a global constant with the value Name it appropriately. Remember
that global constants should be defined before any function definitions. Make sure to
include specific functions: a function which prompts the user for the radius and
returns that value radius should be a double; a function which calculates the volume
for the provided radius; a function to display the result. Please use function
declarations and comment that section appropriately. Also, before the body of each
function, please provide a brief line comment describing the basic operation of the
function, including inputs and output.
For both programs, you will be graded on the following criteria:
Style:
points for comments: Every section should have at least a brief description of the lines
that follow. The very top of your code should contain your name, the name of the
program, and a brief description of what the program does and the important variables.
points for whitespace: Blank lines should precede all sections of code compiler
directives like #include statements, variable declarations, calculations, all functions, etc
Proper indentation must be used as appropriate.
point for variable names, constant names, program name, function names: All
variables and constants must be named appropriately. Names should be as short as
possible, while still being descriptive enough for someone else to understand. All
variables should be in lowercase, with the possible exception of the first letter of distinct
words, for example finalBalance. All constants should be in UPPERCASE. Your
program cpp file should have a short, intuitive name. Good program names are
numsum.cpp spherecalc.cpp and so on Please d
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