Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hi, can you please help me solve this problem, please label, explain, and show all the steps on how you got the solution. thanks A

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

hi, can you please help me solve this problem, please label, explain, and show all the steps on how you got the solution. thanks

A *NO 54% 14:01 Introduction to C - Programming Assignment #2 Noles 1. Please read the notes the math library, if statements and while loops. (Tectures 85, 86, Objectives 1. To learn how to use an if statement for conditional execution. 2. To learn how to call muth library functions to and in calculations. 3. To learn how to use hasic repetition to simplify calculations and allow for statements to repeat certain sets of statements multiple times. Problem A: Wedding Invitations (invite.c) Though Arup wants to just send a free E-vitation to all of his guests for his wedding his luncee will have none of it. She has put her foot down and has insisted that they mul out regular invitations. After doing some research, Arup found out that depending on the size of the packages of invitations ordered, there are different prices. He wants you to figure out how many of each package to order, in order to get enough invitations to mail out at the cheupest price. For the purposes of this problem, there are only two packages: 1) One with 50 invitations 2) One with 200 invitations Luch vendor has a different price for the two packages. You'll ask the user to input these two prices, as well as the total number of invitations that need to be sent out. Your job will be to calculate how many of each package to buy for the best deul, and how much will he spent on invitations. Input Specification 1. The cost of both puckuges (in dollars) will be positive reul numbers less than 500. 2. The number of invitations needed will be a positive integer less than 10000. Output Specification The first line of output will specify the number of small packages to huy to minimize the cost of the order of invitations using the following format: You should order X small package(s). where X is the number of small packages to order. The second line of output will specify the number of large packages to buy to minimize the cost of the order of invitations using the following format: You should order Y large package(s). where Y is the number of small packages to order. Saving screenshot... The last line of output should include the total cost of the packages using the following format Your cost for invitations will be $z. where 7. is the minimum enst in question outputted to two decimal places. Output Sample Below is one sample output of running the program. Note that this sample is NOT a comprehensive test. You should test your program with different data thun is shown here bused on the specifications given above. In the sample run below, for clarity and ease of rouding, the user input is given in italics while the progrum output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for clarity's sake.) Sample Run #1 What is the cost of a small package (in dollars)? 50.99 What is the cost of a large package (in dollara ) ? 150.99 How many invitations are you sending out? You should order 1 small package(a). You should order 1 large package(s). Your coat for invitations will be $201.98. Note: There are actually many somewhat tricky test cases for this problem. Keep in mind that the cost of the two packages might be anything. In some cases you might go with all of one package. In other cases, you might need to go with only the other package. Finally, in cases like this sample, a mixture of the packages is necessary. Do not use loop to solve this problem (use loop for the next problem) Problem B: Wedding Invitations 2 invite2.c) Solve Problem A using a loop (while loop). Problem C: Infinite Cake (cake.c) Wedding Cakes come in many designs. One of the designs is a set of cylindrical layers. Lach layer, from top to bottom has a bigger radius than the one above it. The number of people euch layer feeds is based up on the area of the full top surface of the cake. In order for the cukes 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.) 2 of 4 Saving screenshot... 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.75.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 higger 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+813 people, instead of 5.79 +8.66 = 14.45 or 14 people. Constants to se 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 hottom 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 necessury for each individual will be a positive reul number representing cross-sectionul uren 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 cuke 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 21 How many layers will your cake have? What is the radius of the top layer? What is the radius of the bottom layer? 3 of 4 Saving screenshot... How much cake in cross-sectional area does each guest need? 4.5 Your cake will feed 374 guests. Deliverables Three source files: 1) invite.c, for your solution to problem A 2) homec for your solution to problem B 3) cake.c for your solution to problem C All files are to be submitted over Web Courses. Restrictions 1. Test your programs using Fclipse IDF or https://repl.it/languagesic 2. Nume your programs according the instructions (suve them in *.c). 3. Remember to cupture screenshots of the output (suve them in pdf). Grading Details Your programs will he graded upon the following criteria: 1. Correct output. 2. Your progrumming style und Lise of white space. Lven if you have a plan and your program works perfectly, if your programing style is poor or your lise of white spuce is poor, you could get 10% or 15% deducted from your grade. 3. Compiled and run

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions