Question

Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A...

Using: C#

Inventory Management System
Objective: Work with multiple objects and reading data files.
Description: A wholesale distributor has six warehouses (Atlanta, Baltimore, Chicago, Denver, Ely and Fargo) and sells five different items (identified by part number: 102, 215, 410, 525 and 711). Each warehouse may stock any or all of the five items. The company buys and sells these items constantly. Company transaction records contain a transaction code (‘P’ for a purchase or ‘S’ for a sale) followed by an item number and the quantity (bought or sold).
The transaction records are contained in a transaction data file named Transactions.txt.
Sample transaction records: Transactions.txt
P 410 1000
S 215 120
S 711 300
|
A separate data file contains the initial status of the six warehouses at the beginning of the day (i.e., the ending status from the night before). This data file has only six records (lines). Each record (line) contains five numbers that show the quantity on hand for the five items in that warehouse. This file is named Inventory.txt.
Sample status data file: Inventory.txt
500 120 60 0 350
100 230 0 50 0
0 75 0 0 220
600 50 120 300 40
210 160 30 80 50
90 50 90 200 70
|
The status data file is updated by processing the transaction records in the transaction data file according to these rules:
1 – For a sale (‘S’) – subtract the quantity sold from the warehouse that
has the largest supply of that item on hand.
2 – For a purchase (‘P’) – add the quantity purchased to the warehouse
that has the lowest supply of that item on hand.
Instructions:
Write an object-oriented C# application to do the above inventory warehouse processing. Each of the six warehouses should be treated as an individual object. For example, Atlanta would be an object with each of the five part numbers as instance fields. Each of the other warehouses should also be objects with the five part numbers as instance fields. Of course, there would be one class which would be the main (driver) class from which these 6 objects would be created.
In the beginning of the program, the status data file (Inventory.txt) should be read and an object for each warehouse created. The Inventory.txt data file is in the following order: the first line is the Atlanta warehouse, the second line is the Baltimore warehouse, third Chicago, then Denver, Ely and Fargo. After the objects are created, the transactions data file (Transactions.txt) are read and processed.
The objects should be updated as the transaction records are read and processed.
The program should:
1 – Display the initial (beginning-of-day) status for all warehouses.
2 – Process each transaction from the transaction data file and show which
warehouse’s inventory was updated to reflect that transaction.
3 – Display the final (end-of-day) status for all warehouses.

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

PROGRAM IN JAVA:

driver.java

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.io.*;

public class driver {

public static void main(String[] args) {

try

{

File file = new File("Inventory.txt");

String line;

FileReader fileReader = new FileReader(file);

BufferedReader bufferedReader = new BufferedReader(fileReader);

line = bufferedReader.readLine();

String[] parts = line.split(" ");

int i1 = Integer.parseInt(parts[0]);

int i2 = Integer.parseInt(parts[1]);

int i3 = Integer.parseInt(parts[2]);

int i4 = Integer.parseInt(parts[3]);

int i5 = Integer.parseInt(parts[4]);

warehouse wh1 = new warehouse("Atlanta",i1,i2,i3,i4,i5);

line = bufferedReader.readLine();

parts = line.split(" ");

i1 = Integer.parseInt(parts[0]);

i2 = Integer.parseInt(parts[1]);

i3 = Integer.parseInt(parts[2]);

i4 = Integer.parseInt(parts[3]);

i5 = Integer.parseInt(parts[4]);

warehouse wh2 = new warehouse("baltimo",i1,i2,i3,i4,i5);

line = bufferedReader.readLine();

parts = line.split(" ");

i1 = Integer.parseInt(parts[0]);

i2 = Integer.parseInt(parts[1]);

i3 = Integer.parseInt(parts[2]);

i4 = Integer.parseInt(parts[3]);

i5 = Integer.parseInt(parts[4]);

warehouse wh3 = new warehouse("chicago",i1,i2,i3,i4,i5);

line = bufferedReader.readLine();

parts = line.split(" ");

i1 = Integer.parseInt(parts[0]);

i2 = Integer.parseInt(parts[1]);

i3 = Integer.parseInt(parts[2]);

i4 = Integer.parseInt(parts[3]);

i5 = Integer.parseInt(parts[4]);

warehouse wh4 = new warehouse("denver",i1,i2,i3,i4,i5);

line = bufferedReader.readLine();

parts = line.split(" ");

i1 = Integer.parseInt(parts[0]);

i2 = Integer.parseInt(parts[1]);

i3 = Integer.parseInt(parts[2]);

i4 = Integer.parseInt(parts[3]);

i5 = Integer.parseInt(parts[4]);

warehouse wh5 = new warehouse("Ely",i1,i2,i3,i4,i5);

line = bufferedReader.readLine();

parts = line.split(" ");

i1 = Integer.parseInt(parts[0]);

i2 = Integer.parseInt(parts[1]);

i3 = Integer.parseInt(parts[2]);

i4 = Integer.parseInt(parts[3]);

i5 = Integer.parseInt(parts[4]);

warehouse wh6 = new warehouse("fargo",i1,i2,i3,i4,i5);

fileReader.close();

  

file = new File("Transactions.txt");

fileReader = new FileReader(file);

bufferedReader = new BufferedReader(fileReader);

while(true)

{

String line1 = bufferedReader.readLine();

if(line1 == null)

{

break;

}

parts = line1.split(" ");

String ss = parts[0];

int item_num = Integer.parseInt(parts[1]);

int tmp = Integer.parseInt(parts[2]);

if(ss.equals("P"))

{

//find ware house with mininum items

int item = 0;

if(item_num == 102)

Please hit like.

Add a comment
Know the answer?
Add Answer to:
Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A...
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
  • Write a program in C++ that simulates a soft drink machine. The program will need several...

    Write a program in C++ that simulates a soft drink machine. The program will need several classes: DrinkItem, DrinkMachine and Receipt. For each of the classes you must create the constructors and member functions required below. You can, optionally, add additional private member functions that can be used for doing implementation work within the class. DrinkItem class The DrinkItem class will contains the following private data members: name: Drink name (type of drink – read in from a file). Type...

  • Programming Assignment 1 Structures, arrays of structures, functions, header files, multiple code files Program description: Read...

    Programming Assignment 1 Structures, arrays of structures, functions, header files, multiple code files Program description: Read and process a file containing customer purchase data for books. The books available for purchase will be read from a separate data file. Process the customer sales and produce a report of the sales and the remaining book inventory. You are to read a data file (customerList.txt, provided) containing customer book purchasing data. Create a structure to contain the information. The structure will contain...

  • The purpose of this is to use inheritance, polymorphism, object comparison, sorting, reading binary files, and...

    The purpose of this is to use inheritance, polymorphism, object comparison, sorting, reading binary files, and writing binary files. In this application you will modify a previous project. The previous project created a hierarchy of classes modeling a company that produces and sells parts. Some of the parts were purchased and resold. These were modeled by the PurchasedPart class. Some of the parts were manufactured and sold. These were modeled by the ManufacturedPart class. In this you will add a...

  • I am really struggling with this assignment, can anyone help? It is supposed to work with...

    I am really struggling with this assignment, can anyone help? It is supposed to work with two files, one that contains this data: 5 Christine Kim # 30.00 3 1 15 Ray Allrich # 10.25 0 0 16 Adrian Bailey # 12.50 0 0 17 Juan Gonzales # 30.00 1 1 18 J. P. Morgan # 8.95 0 0 22 Cindy Burke # 15.00 1 0 and another that contains this data: 5 40.0 15 42.0 16 40.0 17 41.5...

  • For C++ This is the information about the meal class 2-1. (24 marks) Define and implement...

    For C++ This is the information about the meal class 2-1. (24 marks) Define and implement a class named Dessert, which represents a special kind of Meal. It is to be defined by inheriting from the Meal class. The Dessert class has the following constructor: Dessert (string n, int co) // creates a meal with name n, whose type // is "dessert" and cost is co The class must have a private static attribute static int nextID ; which is...

  • Description 1. This project will create a base account class that has the members: std::string account_code;...

    Description 1. This project will create a base account class that has the members: std::string account_code; std::string first_name; std::string last_name; double balance; Provide a constructor that initializes ALL members in its initialization list with data passed in as arguments to the constructor. Provide any accessor functions you may need (e.g. to get the account code and balance and to set the balance). In addition, include two pure virtual functions that look like the following: virtual void monthly_update() = 0; virtual...

  • CSBP 319 Data structures - Linked Lists - USE JAVA (NetBeans) A company would like to...

    CSBP 319 Data structures - Linked Lists - USE JAVA (NetBeans) A company would like to implement its inventory of computing machines as a linked list, called ComputerList. Write a Computer node class, called ComputerNode, to hold the following information about a Computer: • code (as a String) • brand (as a String) • model (as a String) • price (as double) • quantity (as int) ComputerNode should have constructors and methods (getters, setters, and toString()) to manage the above...

  • 10.3 Name_year in C - phase 3 This lab is part 2 of a series of...

    10.3 Name_year in C - phase 3 This lab is part 2 of a series of 3 labs that will walk you through the process of creating a C struct and related functions that are the equivalent of the Name_year class you created in chapter 9. For this phase, we will Create an init_name_year() function that initializes a Name_year object. Move the object initialization logic from create_name_year() to init_name_year(). Create a function called compare_name_year() to compare two Name_year objects. The...

  • Using C++ in Visual Studios Rewrite the code to use a Stack instead of a Queue....

    Using C++ in Visual Studios Rewrite the code to use a Stack instead of a Queue. You will need to think about the differences in the Stack and Queue. Think about how they operate and how the nodes may differ.   Modify the code as necessary. You will need to push to the Stack, pop from the Stack, peek at the Stack. You will need a member functions like in the example code. Your program will need to show that everything...

  • write a C++program to analyze a small subset of the data that has been collected. See...

    write a C++program to analyze a small subset of the data that has been collected. See file universities.txt .Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate with in six years. Note that the percentage of student accepted is not stored.An output file is opened in main() and remains open until the...

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