Hello!
I am trying to find how many jelly beans can fit in a jar. so I made some variables.
double height, diameter, beanLength, beanDiameter, glassThickness, radius, newRadius;
double volumeOfJar, airCubicInches, trueVolume, jellyBeanVolume;
as show here. But I need to initialize them. so I tried this
int height;
int diameter;
int beanLength; beanLength = 0.625;
int beanDiameter; beanDiameter = 0.25;
int glassThickness;
int radius;
int newRadius;
int volumeOfJar;
int airCubicInches;
int trueVolume;
int jellyBeanVolume;
But my program does not like that. How do I fix the varibles to be initialized?
Declare all the variables to be double as stated in the question.
double height;
double diameter;
double beanLength; beanLength = 0.625;
double beanDiameter; beanDiameter = 0.25;
double glassThickness;
double radius;
double newRadius;
double volumeOfJar;
double airCubicInches;
double trueVolume;
double jellyBeanVolume;
Comments
Leave a comment