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.
The answer to this question is as follows:
The code is as follows:
#include<iostream>
using namespace std;
int main() {
int no_of_engines,no_of_boxes,no_ofpackages,remaining;
double box_cost,package_cost;
cout<<"Enter the number of engines needed:";
cin>>no_of_engines;
cout<<"\nEnter the cost of a box of 24 engines:";
cin>>box_cost;
cout<<"\nEnter the cost of a package of 3 engines:";
cin>>package_cost;
no_of_boxes=no_of_engines/24;
remaining=(no_of_engines-(no_of_boxes*24));
if(remaining%3!=0)
no_ofpackages=remaining/3+1;
else
no_ofpackages=remaining/3;
if(no_of_boxes>0)
{
cout<<"\nYou will need to purchase "<< no_of_boxes
<<" box and "<<no_ofpackages <<" packages of
engines at a total cost of
$"<<(no_of_boxes*box_cost)+(no_ofpackages*package_cost);
}
else
{
cout<<"\nYou will need to purchase "<<no_ofpackages
<<" packages of engines at a total cost of
$"<<(no_of_boxes*box_cost)+(no_ofpackages*package_cost);
}
}
The input and output screenshots are provided below:


#include <iostream> using namespace std; 2 4- int main() { int no_of_engines,no_of_boxes, no_ofpackages, remaining; double box_cost, package_cost; cout<<"Enter the number of engines needed:"; cin>>no_of_engines; cout<<no_of_engines; cout<<"\nEnter the cost of a box of 24 engines:"; cin>>box_cost; cout<<box_cost; cout<<"\nEnter the cost of a package of 3 engines:"; cin>>package_cost; cout<<package_cost; no_of_boxes=no_of_engines/24; remaining=(no_of_engines - (no_of_boxes *24)); if(remaining%3!=0) no_ofpackages=remaining/3+1; else no_ofpackages=remaining/3; if(no_of_boxes >0) No to our cout<<"\nYou will need to purchase "<< no_of_boxes <<" box and "<<no_ofpackages «<" packages of engines at a total cost of $"<< else N 0 cout<<"\nYou will need to purchase "<<no_ofpackages <<" packages of engines at a total cost of $"<<(no_of_boxes*box_cost) + 0 0 27
V Execute Mode, Version, Inputs & Arguments GCC 9.1.0 v Interactive Stdin Inputs CommandLine Arguments 30 65.95 8.49 Execute Execute - Result CPU Time: 0.00 sec(s), Memory: 3428 kilobyte(s) compiled and executed in 1.361 sec(s) 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
C++ Model rocket engines (or motors) are generally purchases in boxes of 24 or packages of...
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...
C++ Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth is the circumference around the two smallest sides of the package. If side1, side2, and side3 are the lengths of the three sides, and...
In C++ Assignment 7 - Postal Packages In the Gaddis textbook read Chapter 8 sections 8.1-8.10 and Chapter 9 section 9.1 before starting this assignment. Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth...
In Microsoft Visual Studio (C#): An Internet service provider offers four subscription packages to its customers, plus a discount for nonprofit organizations: Package A: 10 hours of access for $12.95 per month. Additional hours are $4.00 per hour. Package B: 20 hours of access for $14.95 per month. Additional hours are $2.00 per hour. Package C: 30 hours of access for $20 per month. Additional hours are $1.00 per hour. Package D: Unlimited access for $35.95 per month. A nonprofit organizations will get...
Rocket Print Publishing – Case Analysis 20 points Rocket Print is a successful printing and publishing company in its third year. The University of Toledo has been outsourcing more and more of its printing needs. Rocket Print has managed to secure UT as a customer and has survived the challenges of new work that UT demanded in a very short time. Much of this work is to support the printing of customized eBooks. As the first term progressed with Rocket...
2 Onwa Motors sacar dealership that has two types of operation car sales and service. The two divisions operate independently and at the showroom for car r y rate on the service shop (They are oss the s tomach other Despite the independence of the divisions, the company provides incentives to its to som e packages song with the sale of cars now and used Condor the following offer posted one of the windows Click the icon to view the...
please post ONLY flatratepackage.cpp, flateratepackage.h, package inventory.h and package inventory.cpp... Thank you! In this homework, you are going to write a program to represent various types of packages offered by package-delivery services. You need to create an inheritance hierarchy to represent various types of packages with different shipping options and associated costs. The base class is Package and the derived classes are FlatRatePackage and OvernightPackage. The base class Package includes the following attributes: • Sender information: senderName (string), senderAddress (string),...
please disregard the excel question
А B D Question 1 -- Stacy's Travel Agency 2 3 8 Instructions 4. You are an agent at a local travel agency. Your manager has asked you to track your sales of next winter's holiday packages. For each package, customers can schoose whether or not to include a flight in the package. For each sale, an initial down payment of 20% of the total package cost is required. 6 Customers can pay the remainder...
3 Problem 12-23 Make or Buy Decision (L012-3) 12 points eBook Silven Industries, which manufactures and sells a highly successful line of summer lotions and Insect repellents, has decided to diversify in order to stabilize sales throughout the year. A natural area for the company to consider is the production of winter lotions and creams to prevent dry and chapped skin. After considerable research, a winter products line has been developed. However, Silven's president has decided to introduce only one...
This is just part of a C# windows form
Application. When the user enters their information,
checks the check box to save info and hits the payment button the
information is saved to a .txt file. When user enters last name and
clicks autofill if name is found in file it will auto fill the
boxes but i'm having issues with this part. For some reason it
skips the firstname box and enters the last name in the first name...