Project 1
Project 1:
C++ program that implements the described functionality using an array of pointers and dynamically allocated memory. We will also provide a menu for the user to enter commodities and vendor quotations, and save the data to a file.
Objectives:
-
IT Support Team Management: The primary objective is to manage the IT support team (Ramu, Raju, and Shyam) responsible for handling the procurement and budgeting for commodities and workstations for various departments in the organization.
-
Workstation Procurement: The team needs to handle the procurement of workstations, including laptops, mice, headsets, laptop bags, and adapters. The number of each commodity required for each team member should be managed efficiently.
-
Vendor Selection: The team needs to evaluate two vendors and decide which one to choose for purchasing the required commodities. This decision should be based on reasonable prices and keeping the overall budget in mind.
-
Expense Reduction: The team should focus on reducing stationary expenses for employees working from home and allocate those expenses to workstation-related items, ensuring that employees can work without any hindrance.
-
Department-wise Management: The team members are assigned specific departments (ADAS, Electro, Connexion), and they need to maintain the budget and procurement for each department separately.
-
Data Input and Management: The program should provide a user-friendly menu to allow data input for commodities and vendor quotations. The entered data should be saved to a file for future reference.
-
Dynamic Memory Allocation: The program should use dynamic memory allocation to handle arrays of structures for commodities and vendors, allowing flexibility in the number of commodities and vendors.
-
User Interaction: The program should interact with the user through the menu, providing options to input data, display data, and save data to a file.
-
Error Handling: The program should handle invalid inputs and errors gracefully, providing appropriate feedback and instructions to the user.
-
Financial Restructuring: The team's objective is to align the financial structure with the work-from-home policy, ensuring that the organization optimizes its resources and stays within budget constraints.
Here's the step-by-step process:
Step 1: Define the necessary header files and constants.
#include <iostream>
#include <fstream>
using namespace std;
const int MAX_COMMODITIES = 5;
const int MAX_VENDORS = 2;
Step 2: Define the structure for Commodities and Vendors.
struct Commodities {
string name;
int quantities[MAX_VENDORS];
};
struct Vendors {
string name;
int prices[MAX_COMMODITIES];
};
Step 3: Implement functions to input commodities and vendor quotations.
void inputCommodities(Commodities* commodities) {
cout << "Enter Commodities to be purchased:" << endl;
for (int i = 0; i < MAX_COMMODITIES; ++i) {
cout << "Enter name of commodity " << i + 1 << ": ";
cin >> commodities[i].name;
}
}
void inputVendors(Vendors* vendors) {
cout << "Enter Vendor quotations:" << endl;
for (int i = 0; i < MAX_VENDORS; ++i) {
cout << "Enter name of vendor " << i + 1 << ": ";
cin >> vendors[i].name;
for (int j = 0; j < MAX_COMMODITIES; ++j) {
cout << "Enter price of " << vendors[i].name << " for commodity " << j + 1 << ": ";
cin >> vendors[i].prices[j];
}
}
}