+1 (315) 557-6473 

Create a Program to Create Product Management System in C++ Assignment Solution.


Instructions

Objective
Write a C++ assignment program to create product management system.

Requirements and Specifications

program to create product management system in C++

Source Code

// Name:

// Date:

// Program Description:

// Description:

#include

#include

#include

#include

#include

using namespace std;

// Constants for the program

const int MAX_SOAP = 4;

const int MAX_BODY_WASH = 10;

const int MAX_SHAMPOO = 6;

const double WEIGHT_PER_SOAP = 3.0;

const double WEIGHT_PER_BODY_WASH = 5.6;

const double WEIGHT_PER_SHAMPOO = 4.3;

const double OUNCE_TO_POUNDS = 0.0625;

const double COST_PER_MILE = 0.45;

const double COST_PER_POUND = 2.65;

const int MIN_DISCOUNT_RATE = 1;

const int MAX_DISCOUNT_RATE = 10;

// Entry point of the program

int main()

{

// Show the shop info

cout << "Welcome to the Martha's Shop" << endl;

cout << endl;

// Show what items are for sale

cout << "We currently have the following items in stock:" << endl << endl;

cout << "4 bars of Squeaky-Clean-Soap" << endl;

cout << "10 bottles of Better-Body Body Wash" << endl;

cout << "6 bottles of Smoothing Anti-Frizz Shampoo" << endl;

cout << endl;

// For each item ask how many to purchase, we assume the user

// enters the appropriate quantity

cout << "How many bars of Squeaky-Clean-Soap would you like to purchase? ";

int numSoap;

cin >> numSoap;

cout << endl;

cout << "How many bottles of Better-Body Body wash would you like to purchase? ";;

int numBodyWash;

cin >> numBodyWash;

cout << endl;

cout << "How many bottles of Smoothing Anti-Frizz Shampoo would you like to purchase? ";

int numShampoo;

cin >> numShampoo;

cout << endl;

// Ask for the customer information

cout << "Enter the name for this order ";

string customerName;

cin.clear();

cin.ignore();

getline(cin, customerName);

cout << endl;

cout << "Enter the shipping address ";

string customerAddress;

getline(cin, customerAddress);

cout << endl;

cout << "Enter the number of miles from store ";

int numMiles;

cin >> numMiles;

cout << endl;

// Calculate the total distance cost

double distanceCost = numMiles * COST_PER_MILE;

// Calculate the total weight in ounces then convert it to pounds then calculate the cost

double totalWeightInOunces = numSoap * WEIGHT_PER_SOAP + numBodyWash * WEIGHT_PER_BODY_WASH + numShampoo * WEIGHT_PER_SHAMPOO;

double totalWeightInPounds = ceil(totalWeightInOunces * OUNCE_TO_POUNDS);

double weightCost = totalWeightInPounds * COST_PER_POUND;

// Calculate the subtotal

double subtotal = distanceCost + weightCost;

// Generate a random value for the discount and calculate the discount

double discountRate = (rand() % MIN_DISCOUNT_RATE + 1.0) / 100;

double discount = subtotal * discountRate;

// Calculate the total shipping cost

double totalCost = subtotal - discount;

// Create the receipt

cout << "Customer Name: " << customerName << endl;

cout << "Shipping To: " << customerAddress << endl;

cout << endl;

cout << fixed;

cout << setw(20) << left << "Distance Cost:" << setw(10) << right << setprecision(2) << distanceCost << endl;

cout << setw(20) << left << "Pound Cost:" << setw(10) << right << setprecision(2) << weightCost << endl;

cout << setw(20) << left << "Subtotal:" << setw(10) << right << setprecision(2) << subtotal << endl;

cout << setw(20) << left << "Discount pct:" << setw(10) << right << setprecision(2) << discountRate << endl;

cout << setw(20) << left << "Discount:" << setw(10) << right << setprecision(2) << discount << endl;

cout << endl;

cout << setw(20) << left << "Total Shipping Cost:" << setw(10) << right << setprecision(2) << totalCost << endl;

cout << endl;

cout << "Thank you for shopping with us! Have a great day!" << endl;

return 0;

}