Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your company is a major clothing manufacturer who sells to most major department and clothing stores throughout the US. Because of the size of your

Your company is a major clothing manufacturer who sells to most major department and clothing stores throughout the US. Because of the size of your business, you extend a line of credit to all your customers. When a customer places an order, one of your associates enters their names into the system and looks up that customer, and enter the selected items and quantities. The system should only allow the associate to create orders for existing customers, and only allow items to be added as long as they have not surpassed the maximum on their remaining line of credit. Implement non-recursive versions of the selection sort, binary search and linear search algorithms.

You are provided a pipe delimited customer file, customer.dat. This file contains the following information:

  • Customer Number,
  • Customer Name,
  • Line of Credit,
  • Address

This information should be read for the text file and loaded into a struct called customer, which is defined as follows:

struct Customer { string customerNum; string customerName; double lineOfCredit; Address * corperateAddress;

}

Customers should be sorted by customer number. Note that the last member of the struct is a pointer to an Address object. Address is another struct. You should create a vector of addresses as you read in the file. You should only create a new address element if it is not already in the vector. If the address is already in the vector then the pointer should use the address of that element. The Address struct is as follows:

struct Address{ string streetAddress; string city; string state; string zipCode; }

You should be able to find and select a customer by customer number or name. Use the binary search method when searching by customer number, and the linear search method when searching by name. Once the customer is selected allow the associate to enter the product code and quantity for the items being requested by the customer. A list of items is provided in the inventory.dat file. This file contains:

  • Item Number
  • Item Description
  • Unit Price

The inventory items should also be loaded into a struct as described below:

struct Product{ int itemNo; string description; double price; }

As the associate enters the items and quantities, the system should verify that you the customer still has available credit. The system should also verify that the associate is entering accurate information. Once completed, the system will display a final order summary. The order summary should also be written to a file (the filename should be the order number). Below is a sample output.

------------------------------------------------- B2B Shopping Cart ------------------------------------------------- Order Number: 1294548238 Associate: Jim

Customer Number: 3542134 Customer: Macys Address: 7 West Seventh Street Cincinnati, OH 45202 ------------------------------------------------ Item No Description Qty Total ------------------------------------------------ 1232 Kids T-Shirt 100 400.00 5743 Mens Polo 500 5000.00 2424 Womens Polo 750 9000.00 3423 Womens Cami 800 1032.00 ------------------------------------------------ Total 15432.00 ------------------------------------------------ Remaining Credit 84568.00

Use the following function to generate the order number.

#include

#include

string getOrderNum(){

time_t now = time(0);

string oNum;

stringstream strstream;

strstream << now;

strstream >> oNum;

return oNum;

}

Use the following function to parse the strings read from the file

#include

#include

vector parse(string line, char delimiter){

vector parsedLine;

istringstream stringStream( line );

while (stringStream)

{

string s;

if (getline( stringStream, s, delimiter))

parsedLine.push_back(s);

}

return parsedLine;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

What are the benefi ts of studying communication?

Answered: 1 week ago