Question

The One Stop Fabric Shop sells 80 yards bolt of fabric for $100 each. Your job...

The One Stop Fabric Shop sells 80 yards bolt of fabric for $100 each. Your job is to write a program that provides an invoice to a customer that will also include information on anything that might be back ordered.

The program should have a function that asks for the following data:

  • Customer information (include name, mailing address and phone number)
  • The number of bolts ordered.
  • The number of bolts in stock.
  • Whether there are special shipping and handling charges. (Shipping and handling is normally $10 per bolt.)
  • Some customers may have special shipping and handling charges associated to having their own accounts to charge. If the customer has their own account their shipping and handling charges should be entered by the customer. This is a charge that is not collected by One Stop Fabric Shop but should still display as part of the invoice.

You should set up your output to a file (name it invoice.txt). The output file should look familiar to an invoice, you may get ideas of what invoices look like by searching online. Information that must be found on the invoice includes:

  • The address for One Stop Fabric Shop (300 N. Beaty St. Athens, AL 35611. phone: 256-233-6500)
  • The customer information
  • The number of bolts the customer is ordering and the amount for each followed by the amount that it will cost for the order.
  • If the customer is ordering more bolts than what is available in stock, then the number of bolts being ordered should not include the backorder. There should be an addition line similar to that above that shows the backorder (this will be shipped and charged when the order is filled).
    • Note: Customer should not have a shipping charge for back ordered items
  • The cost of tax (tax is 8.73%)
  • The total for the order
  • The total for the order with shipping and handling.
  • There should also be an invoice number that is randomly generated by your program (use the rand function here).

You should have three functions for this program:

  1. Gather the customer information.
  2. Get the stock information (this function should be a pass by reference, you are obtaining the number of bolts the customer wants, the number that is in stock, and if there are any special shipping charges).
  3. A function that displays all of the information in the invoice.

c++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The required code is given below in case of any doubts you can ask me in comments and please sure to upvote as it is helpful for my career.

main.cpp

#include <iostream>
#include <stdlib.h>
#include<time.h>

using namespace std;

string getName()
{
string name;
cout<<"Enter you name : ";
cin>>name;
return name;
}


string getAddress()
{
string add;
cout<<"Enter you Mailing Address : ";
cin>>add;
return add;
}

string getPhone()
{
string phn;
cout<<"Enter you phone number : ";
cin>>phn;
return phn;
}

long int getBolts()
{
long int num;
cout<<"Enter number of bolts ordered : ";
cin>>num;
return num;
}

int getBoltsStock()
{
int numS;
cout<<"Enter bolts present in Stock : ";
cin>>numS;
return numS;
}

bool specialCharges()
{
bool spcl = false;
char ch;
cout<<"Are there any spcial handliing and shipping charges (y/n): ";
cin>>ch;
if(ch == 'y')
{
spcl = true;
}
return spcl;
}

double spclCharge(bool spcl)
{
double charges;
cout<<"Enter the special charges : ";
cin>>charges;
}

void printInvoice(string name,string add,string phno,int bolts,double amt,bool back,int backbolts,double backAmt,double tax,double totalFinal,double del)
{
cout<<endl<<"-----------------------------------"<<endl;
cout<<" One Stop Fabric "<<endl;
cout<<"300 N. Beaty St. Athens, AL 35611"<<endl;
cout<<" phone: 256-233-6500 "<<endl;
cout<<endl;
cout<<"Invoice No. : "<<rand()<<endl;
cout<<"Customer Name : "<<name<<endl;
cout<<"Address : "<<add<<endl;
cout<<"Contact No. : "<<phno<<endl;
cout<<"Bolts Ordered : "<<bolts<<" Amount : "<<amt<<endl;
if(back)
cout<<"Back Order : "<<backbolts<<" Amount : "<<backAmt<<endl;
cout<<"Tax : "<<tax<<endl;
cout<<"Delivery charges : "<<del<<endl;
cout<<"Final Price : "<<totalFinal<<endl;
cout<<endl<<"-----------------------------------"<<endl;
}

double calcAmount(int bolts)
{
double amt = bolts*100;
return amt;
}

double calcTax(double total)
{
double amt = total * 0.0873;
return amt;
}

int main()
{
srand(time(0));
string name,mailingAdd;
string phone;
int boltsOrdered,boltsStock;
double total,tax,finalTotalDel ;
int backstock = 0.0;
bool back = false;
double del = 10.0;
bool spcl;
double spclchrge=0.0,amt,backAmt = 0.0;
name = getName();
mailingAdd = getAddress();
phone = getPhone();
boltsOrdered = getBolts();
boltsStock = getBoltsStock();
spcl = specialCharges();
if(spcl)
spclchrge = spclCharge(spcl);
if(boltsOrdered > boltsStock)
{
back = true;
backstock = boltsOrdered - boltsStock;
boltsOrdered = boltsStock;
}
backAmt = calcAmount(backstock);
amt = calcAmount(boltsOrdered);
total = backAmt + amt;
tax = calcTax(total);
del = del*boltsOrdered;
del = del + spclchrge;
finalTotalDel = total + tax + del + backAmt;
printInvoice(name, mailingAdd, phone, boltsOrdered, amt, back, backstock, backAmt, tax, finalTotalDel,del);
return 0;
}
OUTPUT

Add a comment
Know the answer?
Add Answer to:
The One Stop Fabric Shop sells 80 yards bolt of fabric for $100 each. Your job...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring...

    this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring for 100 each and ships them for 10 a piece. write a program that displays the status of an order. it should use two functions in addition to function main(). the first function asks for the following date and stores the input values in reference parameters. the number of spools ordered. the number of spools in stock. Any special shipping and handing charges. the...

  • 1 Normal 1 No Spac. Heading 1 Heading 2 TitleSubtitle Subtle Em... .Emphe 2 Title Styles...

    1 Normal 1 No Spac. Heading 1 Heading 2 TitleSubtitle Subtle Em... .Emphe 2 Title Styles Ch 6 Programming Challenge 14: Order Status lesale Copper Wire Company sells spools of copper wiring for $100 each. Write a program that displays the status of an order as in the example output below. The program should have a fanction that asks for the following data: The number of spools ordered - The number of spools in stock Whether there are special shipping...

  • Boston high students want to open their own shop to sell things for their customers. For...

    Boston high students want to open their own shop to sell things for their customers. For instance, they can open a business of their own that sell things such as electronic devices ,drones ,books, clothing, or anything. Therefore they must use a customized program for their shops. The program is like stocks inventory and sales systems combined into one system. For example to develop Management Retailer System (Stock Inventory and Customer Sales). The program must be able to calculate and...

  • The purpose is to serve as a bridge between your existing knowledge of HTML/JS and the...

    The purpose is to serve as a bridge between your existing knowledge of HTML/JS and the server side programming. You are required to use Node.js, Express and EJS for this assignment.. Tasks: In this assignment, you are to develop a web application for an online store. The type of store that you design, and its inventory is left to your discretion. 1. HTML Static Content - Web Form • The front end must collect all the information needed to mail...

  • Use case diagram for Mail Order System Requirements(draw by use case diagram) This software system is...

    Use case diagram for Mail Order System Requirements(draw by use case diagram) This software system is developed to support mail order business operations. In particular software shall: - Keep track of sales (including orders, payments, and shipments). For each order a record shall be kept identifying the customer, the ZIP code, the salesperson, item ordered, the quantity, and amount due. - Record shall be kept for each customer who made a purchase in the past year. Such record shall include...

  • Create a cause and effect diagram for the following case: Case Study Eastern Gear,Inc.: Job Shop...

    Create a cause and effect diagram for the following case: Case Study Eastern Gear,Inc.: Job Shop Eastern Gear, Inc., in Philadelphia, Pennsylvania, is a manufacturer of custom-made gears ranging in weight from a few ounces to over 50 pounds. The gears are made of different metals, depending on the customer's requirements. Over the past year, 40 different types of steel and brass alloys have been used as raw materials. See Exhibit 1 for details. be necessary to stop production and...

  • Data Analysis Project Part 1 Custom Fabric Ventures is a small company that produces fabric-based wardrobe...

    Data Analysis Project Part 1Custom Fabric Ventures is a small company that produces fabric-based wardrobe accessories (such as, handbags, scarves, and headbands) and home accessories (such as placemats, pillows, and window treatments).   The company keeps a limited number of popular items in stock, but primarily produces custom orders. Customers are able to choose from a wide selection of styles, sizes, and fabrics for each type of product. Most of the company’s customers are small boutiques, home décor shops, and home-decorators...

  • Objective: The objective of this assignment is to write use cases, draw use case diagram and...

    Objective: The objective of this assignment is to write use cases, draw use case diagram and activity diagram. Assignment Specification: A retail store wants to build an online system for their customer to place orders online and for pickup later from the store. Customers join the system by registering online (username (email), password, address, phone no) and including a credit card for use in online ordering; at that time they use login credentials (uername and password) to enter the online...

  • . On-the-Vine Vineyard Valley. On-the-Vine Vineyard, Inc., is one of California's largest winemak...

    this is for CIS . On-the-Vine Vineyard Valley. On-the-Vine Vineyard, Inc., is one of California's largest winemaking facilities in Sonoma striving to make both a visit to the vineyard and the wine tasting an unforgettable On-the-Vine is a small, family-owned winery, specializing in limited production of Chardonnay, Sauvignon Blanc, Merlot, Syrah, Zinfandel, Sangiovese, Viognier, exper and Cabernet. currently employs over 12 full-time employees, with positions have rts to only one supervisor. Each employee is assigned a unique identification number. In...

  • Instructions for using the SAP ERP system start on page 13 of this document. Account Balances...

    Instructions for using the SAP ERP system start on page 13 of this document. Account Balances as of December 31, 2018 Debit Balance Credit Balance 100000 Bank Account $277,518 110100 Accounts Receivable (Direct Posting Account) 92,670 110150 Allowance for Bad Debts 2,500 200600 Inventory-Operating Supplies 8,832 200900 Inventory-Raw Materials (Direct Post) 52,000 200910 Inventory-Finished Goods (Direct Post) 281,298 200920 Inventory-Trading Goods (Direct Post) 66,474 210000 Prepaid Insurance 5,000 212000 Prepaid Advertising 1,100 220110 Land (Direct Post) 425,000 220210 Production Machinery,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT