What is Online Trading System?

Online Trading System (OTS) is a virtual marketplace where people with common business interest meet online to perform various business activities. The major business activities include buying, selling and providing logistic services for transportation of items. All the users need to be registered with the system in order to make any activity. Round-the-clock availability, the speed of access, the wide range of goods and services for the buyer at competitive price, easy accessibility, and global reach are the few major aspects which gives an extra edge to online trading over the traditional trading.

How Online Trading System works?

All the users who are interested in the system are required to register with the system by opening appropriate account as explained in Figure 1. In general all the registered users are known as traders. There are three types of account offered by OTS.

1. Buyer account
2. Seller account
3. Logistic Partner account

Data is the crucial part for any system to perform the desired task. Therefore, the first step for OTS is to provide it with the required data. It includes the following steps:

1. Buyers got registered to OTS by opening buyer account
2. Sellers got registered to OTS by opening seller account
3. Logistic Partner got registered to OTS by opening logistic partner account
4. Seller add item details to OTS, they want to sell

After successful loading of required data, the OTS is geared up to perform various business transactions. In a real-world physical store, where the buyer simply pickup the desired item, proceed to the checkout counter, hand over cash, and leave the store with the purchased item(s) that's a transaction. Just like real-world, the online system works in a similar fashion.

Figure 1 - Working of Online Trading System see image.

The actual business activity starts when a buyer places an order in the system. The order must include at least one item. Moreover, the order must include item(s) offered by a single seller. If the buyer wishes to buy from multiple sellers, he needs to place another order so that each order will contain item(s) of a single seller only.

The status of the order is set to inprogress, once the order is initiated by the buyer. Then the respective seller is responsible to take action. For example, the seller processes the order and sets the status, whether the order is Approved or it is Rejected. The order is approved, the seller will package up all items together of the order and hand over it to the Logistic Partner for delivery and at same time, the order status will change to Shipped. Finally, when the order is delivered to buyer, the Logistic Partner will change the order status to Delivered. During the order process, the buyer can view the assigned Logistic Partner's details and status of the order via the system. The whole order status is shown in Figure 2.

Figure 2 - Flow Chart of one order processing: see image.

The system records each and every business activity performed including all type of trader registration, Order placements, Items included in each order, Items for sale, details of buyer, seller and Logistic Partner for a particular order. The system generates a detailed report of all these activities as well as it is also capable of generating ind reports for each buyer that include all of the buyer's details including his complete order history.

You are required to develop the Online Trading System simulation software to simulate various Online Trading oriented functionalities. The system partner, sellers, and items etc.

1. Analysis phase

As know, analysis phase is the first step taken to develop software. For simplicity, the UML class diagrams is provided and it shows the involved objects and the relationships among them. According to the given UML, you are required to define java classes that describe the properties, behaviors and the relationships of the identified objects. As depicted in UML figure, there are eight classes. Five of them to model objects. Four for modeling physical objects such as seller, buyer, item and logistic partner, while the fifth for modelling non- physical objects such as order. Dealer and trader classes are general ones used to avoid redundancy in seller, buyer, and logistic partner classes. OTSEngine class represent the high abstraction level of teh system, and all functions (methods) of the system invoked through the object of this class.

Please note you are not forced to shape your classes and their relationships as exactly as the ones in the given UML. However, you have to apply the inherence concept to avoid redundancy and also do not change the skeleton of OTSEngine class because it represents the high abstraction functionalities of the System.

2. Implementation (or coding ) phase

OSTEngine.java represents the high abstraction level of the system having all the vital functionalities required by the system. The OTSEngine class skeleton is provided to you as part of this assignment. You need to implement all of its functionalities without changing the method names and its structure.

Following is the details of these functionalities:

OTSEngine()

This parameterized constructor will create arrays for Item, Buyer, Seller and LogisticPartner in the system. The constructor has 4 parameters to initialize the array size for number of Items, number of Buyers, number of Sellers, and number of Logistic Partners respectively in the OTS.

Example
OTSEngine(30, 30, 30, 30)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 numberOfItems int Array size of Item array 30
2 numberOfBuyers int Array size for Buyer array 30
3 numberOfSellers int Array size for Seller array 30
4 numberOfLogisticPartner int Array size for LogisticPartner array 30

addBuyer()

This method will add a new Buyer to the system. The method has 9 parameters as shown in below example:

Example
addBuyer(17010, "Hamed_Hamadan", "Egyption", 1998, 8, 5, 'M',
36640454, "Riyadh")

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 Id int ID of the buyer 17010
2 name String Name of buyer Hamed_Hamadan
3 nationality String Nationality of buyer Egyptian
4 year int Year of registration of buyer 1998
5 month int Month of registration of buyer 8
6 day int Day of registration of buyer 5
7 gender char Gender of buyer M
8 phone int Phone number of buyer 36640454
9 address String Address of buyer Riyadh

Note: The system should NOT accept to add the Buyer if a Buyer with same buyerID already exists in the system. In this case the system will display an appropriate error message like:

The buyer with id 17001 already exists

addSeller()

This method will add a new Seller to the system. The method has 13 parameters as shown in below example:

Example
addSeller(16001,"Ali_Alghamdi","Saudi",1990,5,8,'M',547871054,"
Kandara","AlEssai_Electronics",55475,TRUE,124

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 Id int ID of the seller 16001
2 name String Name of seller Ali_Aghamdi
3 nationality String Nationality of seller Saudi
4 year int Year of registration of seller 1990
5 month int Month of registration of seller 5
6 day int Day of registration of seller 8
7 gender char Gender of seller M
8 Phone int Phone number of buyer 547871054
9 address String Address of buyer Kandara
10 company String Company name of seller AlEssai_Electronics
11 licenseNo int License number of seller 55475
12 operational boolean Operational status of buyer TRUE
13 regNumber int Registration number of buyer 124

Note: The system should NOT accept to add the Seller if a Seller with same sellerID already exists in the system. In this case the system will display an appropriate error message like:

The seller with id 16001 already exists

addLogisticPartner()

This method will add a new Seller to the system. The method has 13 parameters as shown in below example:

Example
addLogisticPartner(15001,"Alaa_Ahmad_Zahrani","Saudi",1973,10,1
2,'M',534528754,"Rehab","PACE_LOGISTICS",478,FALSE,13)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 Id int ID of the logistic partner 15001
2 name String Name of logistic partner Saudi
3 nationality String Nationality of logistic partner Saudi
4 year int Year of registration of logistic partner 1973
5 month int Month of registration of logistic partner 10
6 day int Day of registration of logistic partner 12
7 gender char Gender of logistic partner M
8 Phone int Phone number of logistic partner 534528754
9 address String Address of logistic partner Rehab
10 company String Company name of logistic partner PACE_LOGISTICS
11 regNumber int Registration number of logistic partner 478
12 operational boolean Operational status of logistic partner FALSE
13 ratePerKG double Rate per KGoflogistic partner 13

Note: The system should NOT accept to add the Logistic Partner if a Logistic Partner with same logisticPartnerID already exists in the system. In this case the system will display an appropriate error message like:

The Logistic Partner with id 15001 already exists

addItem()

This method will add a new Item to the system. The method has 5 parameters as shown in below example:

Example
addItem(501,"Setalliite_Laptop",1499,20,16003)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 itemId int ID of the item 501
2 itemName String Name of item Setalliite_Laptop
3 price double Price of item 1499
4 inStock int Number of items in stock 20
5 sellerId int Seller ID of item 58741

initializeOrder()

This method will initialize a new order in the system. The method has 2 parameters as shown in below example:

Example
initializeOrder(17010, 3)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 buyerId int ID of the buyer 17010
2 totItem int Total number of item(s), the buyer want to purchase 3

Important: The initializeOrder() method will automatically generate orderId, starting from 101.

Note: The system should NOT accept to initialize the order if the provided buyerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no buyer with id: 12345

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 orderId int ID of the order 12338
2 buyerId int ID of the buyer 17010
3 itemId int ID of the item 501

Note: The system should NOT accept to add the item to the order if the provided buyerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no buyer with id: 12345

The system should NOT accept to add the item to the order if the provided itemID doesn't exists in the system. In this case the system will display an appropriate error message like:

The item with id 56789 is not in the system

The system should NOT accept to add the item to the order if the provided item is out of stock in the system. In this case the system will display an appropriate error message like:

The item with id 504 is out of stock

associateLogisticPartnerToOrder()

This method will associate an order to a particular logistic partner. The method has 3 parameters as shown in below example:

Example
associateLogisticPartnerToOrder(101,15001,5.4)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 orderId int ID of the order 101
2 logisticPartnerId int ID of the buyer 50001
3 weightOfPackageInKG double Weight of the package in KGs 5.4

Note: The system should NOT accept to associate the order to a Logistic Partner if the provided logisticPartnerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no logisticPartner with id 67890

The system should NOT accept to associate the order to a Logistic Partner if the provided orderID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no order with id 63432

The system should NOT accept to associate the order to a Logistic Partner if there is no item added to the order. In this case the system will display an appropriate error message like:

There is no item added for the order id 210

updateOrderStatus()

This method will update the order status of a particular order. The method has 2 parameters as shown in below example:

Example
updateOrderStatus(12338, "Approved")

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 orderId int ID of the order 12338
2 orderStatus String Status of the order Approved

Note: The system should NOT update the order status if the provided orderID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no order with id 63432

printOrderOfBuyer()

This method will print a specific order of a buyer. The method has 2 parameters as shown in below example:

Example
printOrderOfBuyer(17010, 12338)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 buyerId int ID of the buyer 17010
2 orderId int ID of the buyer 12338

Sample Output: Following is the sample output printOrderOfBuyer() method. Please note that output will be different for query to query. see image.

printSpecificItemsForSeller

This method will print all the items for sale for a specific seller. The method has 1 parameter as shown in the example below:

Example
printSpecificItemsForSeller(58741)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 sellerId int ID of the seller 58741

Note: he system should display an error message if the provided sellerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no seller with id 73474

Sample Output: Following is the sample output for printSpecificItemsForSeller() method. Please note that output will be differentfor query to query. see image.

printTransactionsOfSeller()

This method will print all transactions performed by a specific seller. The method has 1 parameter as shown in below example:

Example
printTransactionsOfSeller(58741)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 sellerId int ID of the seller 58741

Note: The system should display an error message if the provided sellerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no seller with id 73474

Sample Output: Following is the sample output for printTransactionsOfSeller() method. Please note that output will be different for query to query. see image.

printTransactionsOfBuyer()

This method will print all transactions performed by a specific buyer. The method has 1 parameter as shown in below example:

Example
printTransactionsOfBuyer(17010)

Following are the details of require parameters:

Sr. No. Field Name Data Type Representing... Example
1 buyerId int ID of the buyer 17010

Note: The system should display an error message if the provided buyerID doesn't exists in the system. In this case the system will display an appropriate error message like:

There is no buyer with id 28465

Sample Output: Following is the sample output for printTransactionsOfBuyer() method. Please note that output will be different for query to query. see image.

Details of other Classes

You have to create NINE classes in this program.

  • Trader class is super class of Dealer and buyer classes.
  • Dealer class is a sub-class of Trader and super class of LogisticPartner and Seller.
  • LogisticPartner class is a sub-class of Dealer.
  • Seller class is a sub-class of Dealer.
  • Buyer class is a sub-class of Trader.
  • Order class to store Order details.
  • Item class to store Order lab details.
  • OTSEngine class to implement all the major functionalities required for the system including array creation, object creation and processing commands etc The skeleton of this class is provided to you as part of this assignment.
  • Tester class (OTSTest) to invoke appropriate methods for program to execute successfully. The complete tester class is provided to you as part of this assignment. You don't need to make any changes to it and use it as it is.

3. Testing phase

A. Black-box testing

In the black-box testing technique, there is no need to look at the code structure, and test the functionality of the software under test. Moreover, it also avoids the need to have knowledge about the implementation details and is based on software specifications and requirements.

Both input and expected output file are provided to you as part of this assignment. You need to run the testing class OTSTest.java (which is also provided to you as part of this assignment) and check the correctness of the generated output file for the given input file. Moreover different input files will be used by the evaluator to test different scenarios of the system.

B. White-box testing

White-box testing technique refers to a software testing method in which the internal structure, design, and implementation of the system being tested is known to the tester.

The white-box testing will be performed by your assignment evaluator by examining all of your java code, design and output line by line.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.