Please write variables and program plan (pseudocode) of the C++ programming code below:
#include <iostream>
#include <cmath>
using namespace std;
int getWeight();
float deliveryCharge(int weight);
void displayCharge(int weight);
int main ()
{
displayCharge(getWeight());
return 0;
}
int getWeight()
{
int weight;
cout << "Enter package weight (oz): ";
cin >> weight;
return weight;
}
float deliveryCharge(int weight)
{
if (weight > 16)
{
return (((weight - 16) / 4) * .50 )
+ 3;
}
else
{
return 3;
}
}
void displayCharge(int weight)
{
cout << "Package weight = " << weight / 16
<< " lb. "
<< weight - ((weight / 16) *
16) << " oz." << endl;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << "Delivery charge = $" <<
deliveryCharge(weight);
}
Answer: Hey!! kindly find your solutions below. Let me know if any issue. Thanks.
Pseudocode: Please find pseudocode of the given c++ program.
if any query comment me in the comment box.
function deliveryCharge (weight)
if weight > 16 then
charge = (((weight - 16) / 4) * .50 ) + 3
else
charge = 3
end if
return charge
end function
function displayCharge (weight)
output "Package weight: " + weight / 16 + "lb. " + weight - weight
/ 16 * 16 + "oz. "
output "Delivery Charge: $" + deliveryCharge(weight)
end function
function getWeight
output "Enter package weight(oz):"
input weight
return weight
end function
function Main
displayCharge(getWeight())
end function
Get Answers For Free
Most questions answered within 1 hours.