SENG1110/6110 | Programming Assignment 2 | Programming

Home Recent Questions SENG1110/6110 | Programming Assignment 2 | Programming

Part 2

Specification
The program will manage up to 4 depots. This must be done using an array to hold the Depot objects. Each depot will hold up to 5 products. This must also be done using an array.
When run, the program will display a menu of actions to the user, including one that exits the program. Until the user chooses to exit, the menu is displayed again after each action is completed.

The program should have the following functionalities:
1. A user may add a depot.

The user will specify the depot's name.
There should be an error message if the depot already exists, or if there are already 4 depots.

2. A user may remove a depot.
The user will specify the depot's name.
There should be an error message if the depot does not exist.

3. A user may add a product to a depot.

Normally, the user will specify the product's name, price, weight, and quantity in inventory, along with the depot's name (price, weight and quantity need to be positive, if not, the program will show a message and ask the input again)
If, upon being given a name, there is a product in any depot with that name, the program should indicate this. The user will then only be queried for a quantity and depot name. Other details will be taken from the existing product.
eg: Product <productName> exists, with price $<price> and weight <weight>. Adding additional items.
There should be an error message if the depot does not exist, or already holds 5 different products.

4. A user may remove multiple product items at once.
The user will specify a product name and a depot name, and a positive quantity.
There should be an error message if the product does not exist in the depot, or the depot doesn't exist, or the number of products is less than the number to remove.
Otherwise, the quantity in inventory will be reduced by the specified quantity. After that, if the quantity of the product in inventory is zero, then the product should be removed from the depot. There should be output indicating this.
eg: <numRemoved> items of Product <productName> removed from depot <depotName>
  
5. A user may query for a list of depots.
There should be output, describing the depots. Normally, there should be one line per depot.
eg: Depot <Depotname> has <number> products If there are no depots, the output should be one line.
eg: No depots exist

6. A user may query for a list of products in a depot.
The user will specify the depot's name.
There should be an error message if the depot does not exist. Otherwise, there should be output describing the products.
Normally, there should be one line per product.
eg: Product <productName> has price $<price>, weight <weight>kg, and quantity <quantity> If there are no products, the output should be one line.
eg: No products in depot

7. A user may query about a product's presence in the depots.
The user will specify the product's name.
There should be an error message if the product doesn't exist.
Otherwise, there should be one output line for each depot the product is in.
eg: Product <productname> is in depot <depotName> with quantity <quantity>

8. A user may query for the cumulative value of all products in a depot.
The user will specify the depot name.
There should be an error message if the depot doesn't exist. Otherwise, there should be output describing the cumulative value.
eg: Depot <Depotname> has cumulative product value $<number>
As an example, let's say there exists a depot D1 containing products P1 and P2. P1 has price $10 and quantity 2. P2 has price $5 and quantity 100. The cumulative value of all products in D1 would be 10*2+5*100 = 520.

9. A user may export depot and product information to a file.
The created file should consist of zero or more lines, each of which should have one of these forms: <depotName> <productName> <price> <weight> <quantity>
This indicates that a depot <depotName> exists and holds a product <productName> with the specified details.
eg: newcastle-depot apple 1.50 0.1 20 <depotName>
This indicates that a depot <depotName> exists, but specifies nothing about it's products. It should be output for empty depots.
An error message should be output if the file is unable to be created, or if a problem occurred during writing.
An example file (example.txt) is provided on Blackboard.

10. A user may import depot and product information from a file.
The file format should be the same as that used for exporting.
The imported information is added to the pre-existing depots and products. A "<depotName>" line causes addition of a depot <depotName>, if one does not exist. A "<depotName> <productName> <price> <weight> <quantity>" line normally causes addition of a depot <depotName> if one does not exist, and addition of <qty> items of a product <productName> with price <price> and weight <weight> in that depot. If the product already exists, the <price> and <weight> parts of the line are ignored.

An error message should be output if the file is unable to be opened, or if a problem occurred during reading. This includes cases such as finding a line with an invalid format, and being unable to add a depot or product due to size limits (in both cases, the program continues to process the rest of the file).
Product names and depot names will be converted to lowercase after input (so a product name "Lava lamp" will be interpreted just like "LAVA LAMP").

Search Here

Latest Reviews

  • Marcus
    30 Apr, 2019

    My assignment help services are provided in the best way by this website. The writers have completed my assignment in such a way that they helped me increase my overall performance.

  • Emy
    29 Apr, 2019

    Awesome work done by the experts of this company. I visited this site to get math assignment completed. My assignment was complete in every aspect. Thanks to the professionals who provided assignment writing help.

  • Darina
    25 Apr, 2019

    All thanks to the writers of Assignment Help 4 Me who completed my Physics assignment in the right manner. The structure of the assignment was totally customized according to my needs and that too at cheap prices.

View All Reviews

Facebook

Assignment Help 4 Me