Question: Im confused about the input specifications and what i'm missing from my code, can some please help me? Introduction to C - Programming Assignment #2

 Im confused about the input specifications and what i'm missing frommy code, can some please help me? Introduction to C - Programming

Assignment #2 Notes 1. Please read the notes the math library, if

Im confused about the input specifications and what i'm missing from my code, can some please help me?

Introduction to C - Programming Assignment #2 Notes 1. Please read the notes the math library, if statements and while loops. (Lectures #5, #6, #7) Objectives 1. To learn how to use an if statement for conditional execution. 2. To learn how to call math library functions to aid in calculations. 3. To learn how to use basic 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 fiancee will have none of it. She has put her foot down and has insisted that they mail 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 cheapest price. For the purposes of this problem, there are only two packages: 1) One with 50 invitations 2) One with 200 invitations Each 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 deal, and how much will be spent on invitations. Input Specification 1. The cost of both packages (in dollars) will be positive real 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 buy 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. eclipse-workspace - HW 2/invites - 1.c - Eclipse IDE HW 1 on: 0 Run Local c taxes. c c tictactoe. c c *invites-1.cx *invites-1.c CifPractice. c 8 #include 9 #include 100 int main() { 11 int smallpackagenum=; int largepackagenum=; int invitationnum; float smallpackagecost, largepackagecost, mediumpackagecost; int SMALL_PACKAGE=50; int MEDIUM_PACKAGE=100; int LARGE_PACKAGE=200; float leastcost, currentcost; float costperinvitesmall, costperinvitelarge; printf("Enter cost of small package. "); scanf("%f", &smallpackagecost); printf("Enter cost of medium packages. "); scanf("%f", &mediumpackagecost); printf("Enter cost of large package. " scanf("%f", &largepackagecost ); printf("Enter number of invitations. "); scanf("%d", &invitationnum); costperinvitesmall-smallpackagecost/SMALL_PACKAGE; costperinvitelarge=largepackagecost/LARGE_PACKAGE; if (costperinvitesmall>costperinvitelarge) { largepackagenum=floor(invitationnum/LARGE_PACKAGE); smallpackagenum=ceil((invitationnum% LARGE_PACKAGE)/SMALL_PACKAGE); }else{ smallpackagenum=ceil(invitationnum/SMALL_PACKAGE); leastcost=(smallpackagenum*smallpackagecost)+(largepackagenum*largepackagecost); printf("You should order %d small packages. In", &smallpackagenum); printf("You should order %d large packages. ", &largepackagenum); printf("The cost of invitations is %f. ", &leastcost) R Problems Tasks e Console X Properties CDT Build Console (HW 1] Building in: /Users/Sarah/eclipse-workspace/HW 1/build/default Your cost for invitations will be $z. where Z is the minimum cost 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 than is shown here based on the specifications given above. In the sample run below, for clarity and ease of reading, the user input is given in italics while the program 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 dollars)? 150.99 How many invitations are you sending out? 240 You should order 1 small package(s). You should order 1 large package (s). Your cost 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)

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!