C ++ project

Anonymous
timer Asked: Nov 12th, 2016

Question description

Subject: c++

Your Deadline: Monday, November 14, 2016 at 8:00:00 PM EST [?]

Use Project I code you have developped, Modify it to implement an Automated Management System that can also read from file in a store Management System (object) with the following capabilities:

Read Input from File (10 pts) : Sample Input File is Provided

Write all Console output to a File (10 pts)

Maintain the Inventory and price of items in the store in an Arrays(10 pts)

Implement a point of sale menu for customer purchases (10 pts)

Provide a summary of daily sales and revenues in a report style format (10 pts), by categories and then grand total (10 pts)

The goods offered for sale in a merchants shop (with fixed prices) are: Bananas ($2.50), Oranges ($1.95), Apples ($2.85), Milk ($3.89), Bread ($1.25), Cake ($5.20), Light Bulbs ($1.30), and extension cords ($3.99). Please augment at least 5 or more additional items.

Create a working computer program in C++ programming language: 10 points
Write a Project Report with the following section at a minimum with meaningful content: Background and Introduction, Problem Statement, Solution & Algorithm, Discussion and Analysis, Future Work and Conclusion. 20pts
Comment your code and identify with explanation where each of the following features is implemented in your computer program: (10 pts)
Use Arrays to represent your Data, Pointers use to navigate your arrays, Read/Write to File, Parts of a computer program, Declarations, use of Function Declarations / Functions Definition/Function Call, Objects Definition, use of Objects, use of Control Statements (while/Do-While Loop, for Loop, Use of if / if-else, switch, others), use of Relational Operators, Use of Logical Operators, Use of Compound Operators, use of Calculator methods and data members via access operator, formating methods and operators/functions. (20 points Bonus if all features are implemented),

the code main.cpp :

#include <iostream>
#include <string.h>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
//Global Declarations
//string Introduction;


//void Display_Inventory();//function declaration
//void Display_Report();//function declaration

class StoreManagementSystem{
public:
int Activity;
int StartOverActivity;

//Variable used to manage item being worked on
string ItemName;
int ItemQuantity;
double ItemPrice;
int ItemNumber;
double GrandTotalSale;
//******************

double BananaPrice;
int NumberOfBanana;
double BananaTotal;

double OrangePrice;
int NumberOfOrange;
double OrangeTotal;

//Data member: Handle for file object
fstream MyFileHandleInput;
fstream MyFileHandleOutput;

//Create your Arrays
string MyItemName[100]; //0 based index +1 would be the item number
double MyInventory[2][100]; //2 dimensional array of data about the items: First dimension is row of price and qty, second is 0 based index +1 for item number

//Data member to process file content
string FilebyLine;
string CommandTask;
string Data1; //Item Name or report type for example
double Data2; //Price, Qty, Group by Category
double Data3; //Qty, Purchase Method, Display Invertory
int PurchaseMethod; //(1-Cash, 2-Credit/Debit)
string ReportType; //Detailled, Summary
int GroupByCategory; //1-Group by, 0-Do not Display
int DisplayInventory; //1-Display, 0-Do not Display
int ManualEntry;
int ItemCounter;


StoreManagementSystem()
{
Activity = 0;
StartOverActivity = 0;

//Variable used to manage item being worked on
ItemQuantity;
ItemPrice;
ItemNumber;
GrandTotalSale;
//******************

BananaPrice = 2.50;
NumberOfBanana = 10;
BananaTotal = 0;

OrangePrice = 1.95;
NumberOfOrange = 5;
OrangeTotal;

ManualEntry = 0;
ItemCounter = 0;
}

void WelcomeMessage(){

cout << "Welcome to Prof Hyousseu Store Management System" << endl;
cout << "Please follow all instructions as displayed!" << endl;
cout << endl << endl;
}

void RunStoreApp(){

//You can ask the user whether they want to enter manually or run application from the file

if(ManualEntry == 0)
{

//Open a file as input to this application
MyFileHandleInput.open("Project 2 Input.txt", ios::in);

//Make sure the file has been opened
if (MyFileHandleInput.is_open()) {

while(getline(MyFileHandleInput, FilebyLine))
{
//cout << FilebyLine[0] << endl;
if(FilebyLine[0] == '/' || FilebyLine.empty()){ continue;}

istringstream inputLineStream(FilebyLine);
//cout << inputLineStream << endl;
std::getline(inputLineStream, CommandTask, '\t');
std::getline(inputLineStream, Data1, '\t');

inputLineStream >> Data2 >> Data3; // error

cout << CommandTask << " " << Data1 << " "<< Data2 << " " << Data3 << endl;

if(CommandTask == "Entry")
{

ItemName = Data1;
ItemPrice = Data2;
ItemQuantity = Data3;

MyItemName[ItemCounter] = Data1; //0 based index +1 would be the item number
MyInventory[0][ItemCounter] = ItemPrice;
MyInventory[1][ItemCounter] = ItemQuantity;

ItemCounter = ItemCounter + 1;

//Note: You may want to check that an entry is not a duplicate of the previously captured item

}

if(CommandTask == "Update")
{

ItemName = Data1;
ItemPrice = Data2;
ItemQuantity = Data3;

//search for the item number in the itemName Array
for(int i = 0; i <= ItemCounter; i++)
{
//When item is found, update its record
if(MyItemName[i] == ItemName)
{
ItemNumber = i;
MyInventory[0][i] = ItemPrice;
MyInventory[1][i] = ItemQuantity;
}
}
}

if(CommandTask == "Purchase")
{

ItemName = Data1;
ItemQuantity = Data2;
PurchaseMethod = Data3;

//Search for the item in the inventory

//When items is found, process the sale and update inventory

}

if(CommandTask == "Report")
{

ReportType = Data1;
GroupByCategory = Data2;
DisplayInventory = Data3;

if(DisplayInventory) //If you must display the inventory, then print the inventory table
{

}

if(GroupByCategory) //If you must group by category, then list the items sold by category
{

}

//Output the report of the total sale by category and then the grand total

}



}
}

//Remember to close the file
MyFileHandleInput.close();
}

if(ManualEntry == 1)
{

//do while loop to manage user activity (MANUAL)
do
{

cout << "What activity would you like to perform next?" << endl;
cout << "Please enter 1 for Inventory, 2 for Point of Sale, 3 for Report" << endl;
cout << "Enter Selection: "; cin >> Activity; cout << endl << endl;

if(Activity == 1)
{
cout << endl;
cout << "You chose to update the inventory" << endl << endl;
//Call the function to display inventory
Display_Inventory();

int UpdatePerfomed;
int ContinueInventory = 1; // 0-Exit, 1-Start Inventory Activity Over


while(ContinueInventory == 1) // Start while loop to manage inventory
{


cout << "What item do you want to update? (Enter the item number below)" << endl;
cout << "Item Number: "; cin >> ItemNumber; cout << endl << endl;

if(ItemNumber == 1)
{
cout << "You chose Item 1: Bananas" << endl;
cout << "What do you want to update? Enter 1 for quantity or 2 for price" << endl;

cout << "Selection: "; cin >> UpdatePerfomed; cout << endl << endl;

if(UpdatePerfomed == 1)//User selected to update quantity
{
cout << "Please enter the number the new item quantity" << endl;
cout << "Quantity: "; cin >> ItemQuantity; cout << endl;
NumberOfBanana = ItemQuantity; //Perform the update in the system
cout << "Update was successfull" << endl << endl;
}
else if(UpdatePerfomed == 2)//User selected to update price
{
cout << "Please enter the number the new item price" << endl;
cout << "Price: "; cin >> ItemPrice; cout << endl;
BananaPrice = ItemPrice; //Perform the update in the system
cout << "Update was successfull" << endl << endl;
}
}

if(ItemNumber == 2)
{
cout << "You chose Item 1: Oranges" << endl;
cout << "What do you want to update? Enter 1 for quantity or 2 for price" << endl;

cout << "Selection: "; cin >> UpdatePerfomed; cout << endl << endl;

if(UpdatePerfomed == 1)//User selected to update quantity
{
cout << "Please enter the number the new item quantity" << endl;
cout << "Quantity: "; cin >> ItemQuantity; cout << endl;
NumberOfOrange = ItemQuantity; //Perform the update in the system
cout << "Update was successfull" << endl << endl;
}
else if(UpdatePerfomed == 2)//User selected to update price
{
cout << "Please enter the number the new item price" << endl;
cout << "Price: "; cin >> ItemPrice; cout << endl;
OrangePrice = ItemPrice; //Perform the update in the system
cout << "Update was successfull" << endl << endl;
}
}

//Update token value
cout << "Would you like to perform inventory on another item?" << endl;
cout << "Enter 1 for Yes, and 0 for NO: "; cin >> ContinueInventory; cout << endl << endl;

}// End while loop to manage inventory



}
else if(Activity == 2) //User chose Point of Sale Activity
{
cout << "You chose to run the Cashier" << endl << endl;
int ContinueSale = 1; // 0-Exit, 1-Start Sale Activity Over

//Call the function to display inventory
Display_Inventory();

while(ContinueSale == 1) // Start while loop to manage Cashier Sale
{
//Ask user what items are being sold
cout << "Please enter the item number being sold: " ; cin >> ItemNumber; cout << endl << endl;

if(ItemNumber == 1)
{
cout << "You chose Item 1: Bananas" << endl;
cout << "How many items sold? Enter a number: "; cin >> ItemQuantity; cout << endl;

cout << "You have sold " << ItemQuantity << " Bananas." << endl;
//Compute the sale total for the bananas being sold
BananaTotal = ItemQuantity * BananaPrice; // perfom operation
cout << "Banana Sale Total: $" << BananaTotal << endl;

NumberOfBanana = NumberOfBanana - ItemQuantity;
cout << "New item inventory quantity: " << NumberOfBanana << endl << endl;
}

if(ItemNumber == 2)
{
cout << "You chose Item 1: Oranges" << endl;
cout << "How many items sold? Enter a number: "; cin >> ItemQuantity; cout << endl;

cout << "You have sold " << ItemQuantity << " Bananas." << endl;
//Compute the sale total for the bananas being sold
OrangeTotal = ItemQuantity * OrangePrice; // perfom operation
cout << "Banana Sale Total: $" << OrangeTotal << endl;

NumberOfOrange = NumberOfOrange - ItemQuantity;
cout << "New item inventory quantity: " << NumberOfOrange << endl << endl;
}

//Update token value
cout << "Would you like to enter another item sold?" << endl;
cout << "Enter 1 for Yes, and 0 for NO: "; cin >> ContinueSale; cout << endl << endl;
}

}
else if (Activity == 3)
{
cout << "You chose to run the store summary" << endl << endl;
//Call the function to display summary report
Display_Report();



}

//Update my token to evaluate whether to repeat loop
cout << "Would you like to run another activity?" << endl;
cout << "Enter 0 to Exit, 1 to continue" << endl;
cout << "Choice: "; cin >> StartOverActivity;
cout << endl;

} while(StartOverActivity != 0);
}
}

void Display_Inventory() //function definition
{
cout << endl;
cout << "Item No" << "\t" << "Item" << "\t" << "Qty" << "\t" << "Price" << endl;
cout << 1 << "\t" << "Bananas" << "\t" << NumberOfBanana << "\t" << "$" << BananaPrice << endl;
cout << 2 << "\t" << "Oranges" << "\t" << NumberOfOrange << "\t" << "$" << OrangePrice << endl;
cout << endl;
}

void Display_Report() //function definition
{
cout << endl;
cout << "Item No" << "\t" << "Item" << "\t" << "Total/Sale" << endl;
cout << 1 << "\t" << "Bananas" << "\t" << "$" << BananaTotal << endl;
cout << 2 << "\t" << "Oranges" << "\t" << "$" << OrangeTotal << endl;
cout << endl;

GrandTotalSale = BananaTotal + OrangeTotal;
cout << "Grand Total is: $ " << GrandTotalSale << endl << endl;

}

void ClosingMessage(){
cout << "Thank you for using this application!" << endl << endl;
}

};



int main() {
//Instantiate or create a real object
StoreManagementSystem myStoreApplication;

//calling method members of the object to run application
myStoreApplication.WelcomeMessage();
myStoreApplication.RunStoreApp();
myStoreApplication.ClosingMessage();


return 0;
}

project 2 :
// First Word is task, Then following on same line is data
// Entry ItemName price Qty
// Update ItemName Price Qty
// Purchase ItemName Qty Method (1-Cash, 2-Credit/Debit)
// Report ReportType Group Inventory (1-Display, 2-Do Not Display)

Entry Banana 2.5 50
Entry Orange 1.75 25
Entry Milk 3.45 34
Entry Bread 1.99 16

Update Orange 2.05 32
Update Milk 3.99 31

Purchase Banana 2
Purchase Bread 3
Purchase Orange 5
Purchase Milk 2
Purchase Banana 6

Update Milk 3.45 0


Purchase Banana 3 1
Purchase Milk 2 1
Purchase Bread 1 1

Update Bread 1.99 7
Update Banana 2.35 50

Report Sum
mary 0 2

Entry Apple 3.5 20
Entry Egg 2.35 45
Entry Candy
5.95 64
Entry Cake 12.99 18

Purchase Banana 2 2
Purchase C
ake 3 2
Purchase Orange 5 2
Purchase Egg 2 2
Purchase Candy 6 2


Update Milk 3.88 15
Update Cake 12.99 10
Update Candy 5.9
5 20

Report Detailled 1 1

Tutor Answer

(Top Tutor) Studypool Tutor
School: University of Virginia
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors