Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Homework: Write a sample program in Java to compute the number of chocolate spheres stacked in a triangular pyramid within x triangular layers. n(x) is
Homework:
Write a sample program in Java to compute the number of chocolate spheres stacked in a triangular pyramid within x triangular layers. n(x) is the number of balls required to make x layers.
The value of x is entered by users.
(Try for x = 4, x =5.)
//Formula//
n(x) = 1/6 * x^3 + 1/2 * x^2 + 1/3 x
*Use Buffered Reader class and method readline();
*No if, no loops. Use Java, and be basic so I can understand your coding.
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