Question
C++ Model rocket engines (or motors) are generally purchases in boxes of 24 or packages of 3. If I want 32 engines I would need
C++
Model rocket engines (or motors) are generally purchases in boxes of 24 or packages of 3.
If I want 32 engines I would need to purchase 1 box of 24 and 3 packages of 3 (I would end up with 1 extra engine). Write a program that calculates how many boxes and packages you must purchase to get a specific number of engines. Also enter the price of a box and a package and calculate the total cost of the purchase. Use integer division (/, %) to calculate the number of boxes and packages. Note: when printing out the answer the correct word (box/boxes, package/packages) should appear after the number. If the number is 0, don't print anything at all.
Example Output:
Enter the number of engines needed: 30
Enter the cost of a box of 24 engines: 65.95
Enter the cost of a package of 3 engines: 8.49
You will need to purchase 1 box and 2 packages of engines
at a total cost of $82.93.
-----
Enter the number of engines needed: 10
Enter the cost of a box of 25 engines: 65.95
Enter the cost of a package of 3 engines: 8.49
You will need to purchase 4 packages of engines
at a total cost of $33.96.
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