Question: cake.c Problem C: Infinite Cake (cake.c) Wedding Cakes come in many designs. One of the designs is a set of cylindrical layers. Each layer, from

 cake.c Problem C: Infinite Cake (cake.c) Wedding Cakes come in many

designs. One of the designs is a set of cylindrical layers. Each

layer, from top to bottom has a bigger radius than the one

cake.c

Problem C: Infinite Cake (cake.c) Wedding Cakes come in many designs. One of the designs is a set of cylindrical layers. Each layer, from top to bottom has a bigger radius than the one above it. The number of people each layer feeds is based up on the area of the full top surface of the cake. In order for the cakes to look good, the sequence of radii of the different layers must follow an arithmetic sequence with a positive difference. (If you forgot what an arithmetic sequence is, please go online and look this up.) Your problem will be to figure out how many people a particular cake design can feed, based on the number of layers the cake has, the radius of the top layer cake, the radius of the bottom layer cake, and the amount of cake (described by the area of the top of the piece) that one person eats. For example, if a layer of cake has cross-sectional area 30.7 units- and each person eats 5.3 units- worth of cake, then 30.7/5.3 = 5.79 people can be fed. BUT, people aren't fractional and we can't give someone parts of cake from two different layers. Thus, in this case, we'll say that the cake feeds 5 people and each of those five pieces is a bit bigger than necessary. To correctly solve the problem, make this calculation separately for each layer. For example, if one layer feeds 5.79 people and another layer feeds 8.66 people, together they would only feed 5 + 8 = 13 people, instead of 5.79 +8.66 = 14.45 or 14 people. Constants to Use Please declare the following constant to use in your program: const double PI = 3.141592654; Input Specification 1. The number of layers will be a positive integer less than 100. 2. The radius of the top layer will be a positive real number less than 1000. 3. The bottom layer radius will be a positive real number at least as big as the top layer and less than 1000. (In a one layer cake, this number will be the same as the top layer radius.) 4. The amount of cake necessary for each individual will be a positive real number representing cross-sectional area less than the cross-sectional area of the top layer. Output Specification Output the total number of guests that can be fed with the given cake design: Your cake will feed x guests. where X is the number of guests in question. Output Samples A sample output of running the program is included below. Note that this sample is NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. Sample Run #1 How many layers will your cake have? What is the radius of the top layer? What is the radius of the bottom layer? 14 How much cake in cross-sectional area does each guest need? 4.5 Your cake will feed 374 guests

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!