# Program 1- nursery_inv.cpp

\$30.00

Category:
Rate this product

In this assignment you will implement a program called “nursery_inv.cpp” that calculates the tax
on a purchase (purchase_tax), the net cost of the purchase (net_cost), the discount on the
purchase (discount), and the total cost of the purchase (total_cost). The program should accept
a plant name (pname),the county name (cname), the cost of the plant (plant_cost), and the
quantity of plants purchased (quantity). The program should also ask the user if they would
like to do another calculation. Please consider the following when completing this program:
1) The tax rate (in percent) on a purchase (tax_rate) is based on the county where the
purchase was made. If the county is dade, the tax rate is 6.5%; if the county is broward, the tax
rate is 6%; if the county is palm, the tax rate is 7%.
2) The net cost of a purchase is calculated by the following formula:
net_cost = (quantity x plant_cost ).
3) The discount is based on the quantityof plantsin the purchase. The discount is determined
is follows:
• If quantity equals 0, then the discount is 0% of the net cost;
• If 1<= quantity <=5 then discount = 1% of the net cost; 6<= quantity <=11 then
discount = 3% of the net cost ; if 12<= quantity <=20 then discount = 5% of the net
cost; 21<= quantity <=50 then discount= 8% of the net cost; quantity >50 then
discount =12% of the net cost) . Apply discount after the net cost has been
calculated.
4) The tax on a purchase is calculated by the following
formula: purchase_tax = (net_cost * tax_rate / 100 (drop /100 if you converted the rate
from a percentage)
5). The total cost of a purchase (rounded to the nearest hundredth) is calculated by the
following formula:
total_cost = net_cost+purchase_tax – discount .
N o t e : All tax and cost calculations should be rounded to the nearest
hundredths.
Use the following format information to print the variables:
Field Format
======================================
Plant Name string
County Name string
Plant Cost XXXX.XX
Quantity of Plants XXXX
Net Cost of Purchase XXXXX.XX
Purchase Tax XXXXX.XX
Discount on Purchase XXXX.XX
Total Cost of Purchase XXXXXXX.XX
Use the following skeleton to help you start this program which is allow included as a cpp file
in the module: nursery_inv.cpp
Lofton Bullard Total Points: 10
Due Date:
Course: C0P3014
Assignment: Assignment 1
Professor: Dr. Lofton Bullard
Description: (Your program description goes here — tell what it does–eg…In the program we
processed….
*************************************************************/
#include <iostream> //standard library for i/o
#include <string> // always include this when you use the string class
#include <iomanip>
using namespace std;
int main()
{
//**********MAGIC FORMULA WILL EXPLAIN**************************
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//***************************************************************
string user_response = “y”;
//declare and comment your user variable here
string pname; //string that holds the plant name
string cname; //string that holds the county name
//double plant_cost; //double that hold the cost of a plant;
//int quantity; //int that hold the number of plants purchased;
//double purchase_tax = 0;
//double net_cost = 0;
//double discount = 0;
//double total_cost = 0;
while (user_response == “y” || user_response == “Y”)
{
//The code to get the user’s input if given in the following
//Input Statements
//cout << “Enter the Plant Name: “;
//cin >> pname;
//cout << “Enter the County Name: “;
//cin >> cname;
//cout << “Enter the Plant Cost: “;
//cin >> plant_cost;
//cout << “Enter the Quantity: “;
//cin >> quantity;
//Perform the calculations here
//Calculations
//net_cost = quantity * plant_cost;
//Logic …if else statements
//if (quantity <= 0)
// discount = 0;
//else if (quantity >= 1 && quantity <= 5)
// discount = .01 * net_cost;
//else if ….
//if (cname == “dade”)
// purchase_tax = net_cost * .065;
//else if ….
//total_cost = ….
//Print Results to screen here
//Output Statement
//cout << endl << endl;
//cout << “Plant Name = ” << pname << endl;
//cout << “County Name = ” ….
cout << “Would you like to do another calculation (Y or N): ” << endl;
cin >> user_response;
}
return 0;
}
Handing in your program:
Electronically submit “nursery_inv.cpp” in the Assignments area of Canvas before the due
date and time.Remember, complete the assignment no matter if it is late. It is very
important that you do all assignments to master the C++ programming language and get a