Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with this C++ programming assignment. Can anyone help??? We MUST USE LOOPS for this assignment. ----------- ----------- ----------- Problem A: Wedding Invitations (invite.c)
Need help with this C++ programming assignment. Can anyone help??? We MUST USE LOOPS for this assignment.
-----------
-----------
-----------
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. 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. The last line of output should include the total cost of the packages using the following format: Your cost for invitations will be $2. 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)? 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 necessaryStep 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