Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Instructions: Read the problem description below and implement this program in C++. The files for this assignment are provided under the folder for this

General Instructions: Read the problem description below and implement this program in C++. The files for this assignment are provided under the folder for this assignment. You will be submitting two separate projects. See Part A and Part B for details.

o All of the functions making up this program are complete and in working order except for those marked with ///FILL THIS FUNCTION comments, which you must implement.

o The major challenge in this assignment is to divide the program into separately compiled modules.

An Inventory Update module, consisting of files inbound.h and inbound.cpp, containing code dealing specifically with updating the Inventory from an Invoice.

A Sales module, consisting of files sales.h and sales.cpp containing code dealing specifically with recording a new sale.

There are some functions that are not specifically related to either of these modules, but are called by or contain code needed by certain modules. You should apportion these functions to the modules in a way consistent with the goals of high cohesion and low coupling.

Consult the comments in the provided code for additional details.

o The given code has Global Variables. Your finished code should have no Global Variables. Problem description: A local Nursery needs help managing its inventory. They need to be able to upload new inventory quickly via invoice documents. They also need to be able to manage their inventory efficiently when they make New Sales. In addition to daily inbound and outbound inventory management, they would like to print reports for past sales and current inventory status. Input Input to the program is taken from several text files containing sales data, inventory data, and invoice data. These are included, but your program should function even if the information in the data files were to change with the format being the same. The first line in every file is the number of data points(lines) in the file.

Output The output should be regular updates to the inventory and sales files, as well as interactive menus, sales and inventory reports, and NewSale total at the conclusion of a sale. Part A: Create a project containing the file main.cpp. Implement the empty functions marked with ///Fill This Function comments, remove Global Variables, and ensure correct input and output. The program should compile and have expected Input and Output as outlined above. You will not need to split the functions into Modules for this portion. You DO need to create function declarations and move main() to the top of the list of functions.

Part B: Create a project containing the files main.cpp, inbound.cpp, inbound.h, sales.cpp, sales.h. Split the functions from Part A into the appropriate modules as outlined in the general instructions. The program should compile and have the same input and output as Part A.

MAIN.CPP CODE!

#include  #include  #include  #include  #include  #include  using namespace std; int Icounter=0; int Scounter=0; ///writes inventory data to file void writeInventoryData(std::string inventoryData[][4],int counter) { std::fstream outfile; outfile.open("inventory.txt", std::fstream::out); outfile>amount; std::cin.ignore(); std::cin.clear(); if(amount>ans; std::cin.ignore(33,' '); ///break if answer is correct if((ans=='y'|| ans=='Y')||(ans=='n'||ans=='N')) break; std::cout>cost; std::cin.ignore(); std::cin.clear(); return cost; } ///adds a new item to the inventory that was not carried before void addNewItem(int i, std::string invoice[][3], std::string inventory[][4]) { int tempsize=Icounter+1; ///creates a new inventory 2D array std::string temparray[tempsize][4]; ///double for loop copies old inventory into new 2D array for(int j=0; j>filename; std::cin.ignore(); infile.open(filename.c_str(), std::fstream::in); infile>>sizeInvoice; infile.ignore(); std::string invoice[sizeInvoice][3]; getInvoice(invoice, sizeInvoice, infile); addInvoice(inventory, invoice, sizeInvoice); } ///prints a report of the inventory void printInventory(std::string inventory[][4]) { std::cout>selection; std::cin.ignore(); std::cin.clear(); if(selection>'0' && selection>Icounter; infile.ignore(); ///inventory is reloaded for every selection. this allows for updates to the inventory file std::string inventory[Icounter][4]; loadInventoryData(inventory, infile); infile.close(); infile.open("sales.txt", std::fstream::in); infile>>Scounter; infile.ignore(); ///sales data is reloaded after every loop. this allows for updates to the sales file std::string sales[Scounter][5]; int salesnum=loadSalesData(sales, infile); infile.close(); char select=menu(); switch(select) { case '5': return; case '1': newSale(salesnum, inventory, sales); ///after a sale, write the updated inventory to file writeInventoryData(inventory, Icounter ); break; case '2': printSalesReport(sales); break; case '3': printInventory(inventory); break; case '4': updateInventory(inventory); break; } } } int main() { manager(); return 0; }

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Print Inventory Report Before Inbound Main Menu L New Sales Print Sales Report Print Inventory Report 1 Inbound Inventory Exit nter Selection 3 Inventory Maple Iree Tree 15 45.00 40.00 05.00 05.00 10.00 10.00 10.00 20.00 10.00 60.00 35.00 06.00 8.00 08.00 03.00 10.00 40.00 9 Morning Glory Annual etunia ollyhock igitalis Annual Perennial Perennial Perennial 32 12 25 Aster urning Bush Shrub irch ilac lue Star Ajuga Big Boys Shrub Tree Shrub Perennial Perennial Uegetables Annual Perennial 12 13 480 elphiniun Rhododendron Shrub 45 45 2 Loading an Invoice Main Menu New Sales Print Sales Report Print Inventory Report Inbound Inventory Exit 0 Enter Selection: 4 Enter the file nane of the invoice invoice.txt low nuch to charge for Apple? 35.00 Print Inventory Report Before Inbound Main Menu L New Sales Print Sales Report Print Inventory Report 1 Inbound Inventory Exit nter Selection 3 Inventory Maple Iree Tree 15 45.00 40.00 05.00 05.00 10.00 10.00 10.00 20.00 10.00 60.00 35.00 06.00 8.00 08.00 03.00 10.00 40.00 9 Morning Glory Annual etunia ollyhock igitalis Annual Perennial Perennial Perennial 32 12 25 Aster urning Bush Shrub irch ilac lue Star Ajuga Big Boys Shrub Tree Shrub Perennial Perennial Uegetables Annual Perennial 12 13 480 elphiniun Rhododendron Shrub 45 45 2 Loading an Invoice Main Menu New Sales Print Sales Report Print Inventory Report Inbound Inventory Exit 0 Enter Selection: 4 Enter the file nane of the invoice invoice.txt low nuch to charge for Apple? 35.00

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

Step: 3

blur-text-image

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions