The Shipping company wants to analyze the number of purchase orders raised in a month over a
Question:
The Shipping company wants to analyze the number of purchase orders raised in a month over a year. Since the company has a large amount of this historical data of the purchases, to make the processing faster the tech-team decides to implement the report generation using multi-threading.
Given the order id and the date of purchases, Print all the months that have a minimum of 1 purchase within the month using threads.
a class namedTotalOrderThreadthat implements the Runnable interface with the following private member variables
- List
input - Map
orderMap
Include appropriate getters and setters.
Include a parameterized constructor with the following order (input, orderMap).
And also include the following override methods in the class,
NoMethod NameMethod Description1public void run()Override the run method, here you iterate the csv list(order), compute the number of order placed for a certain month and store the value in a hashmap with month number as key and value as number of purchase orderCreate the class named asMain, Get the inputs in the Main method, get n, the number of orders, the payment details and the number of threads to be executed. Split the list into sublists depending on the number of threads. In the main method once the threads execution are complete, Print the report.
[Note :Strictly adhere to the object oriented specifications given as a part of the problem statement.Use the same class names, attribute names and method names.]
Input Format :
The first line of input contains an integer n, the number of orders. The next n lines contains comma-separated strings that corresponds to the order details. The next line contains an integer t, the number of threads to be executed.
Output Format :
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]
Sample Input and Output :
Enter the number of orders:
24
Enter all the orders:
45512252,12/04/2015 45512522,05/06/2015 45254822,03/05/2015 45221522,20/07/2015 45227855,25/01/2015 45225851,13/02/2015 45221545,18/08/2015 45222124,20/12/2015 45232785,06/02/2016 45235654,05/03/2016 45235451,15/05/2016 45236545,20/05/2016 45237854,22/06/2016 45237864,14/04/2016 45237912,13/03/2016 45238945,16/04/2016 45238955,15/01/2017 45239454,02/01/2017 45239551,06/02/2017 45239560,18/05/2017 45239789,25/06/2017 45239840,12/03/2017 45239856,17/02/2017 45245220,15/11/2017
Enter number of threads to process the data:
2
Jan -- 3
Feb -- 4
Mar -- 3
Apr -- 3
May -- 4
Jun -- 3
Jul -- 1
Aug -- 1
Nov -- 1
Dec
Don'ts:
1. Do not create packages for classes. Strictly adhere to the program structure given in the template code.
3. Do not create multiple classes inside a single file. Cret a separate file for each class.
Cornerstones of Cost Management
ISBN: 978-1285751788
3rd edition
Authors: Don R. Hansen, Maryanne M. Mowen