In this question you will create a method in Forecasting.java named readData that reads the data from Demand.txt located in the input_files directory. a. Create a static method in Forecasting.java named readData with the following signature specifications: • access: public • return type: two-dimensional String array • arguments: none b. In the readData method, create a two-dimensional array named demandValues that stores String values. The first row of Demand.txt contains column headers. readData should read those values in, but disregard (do nothing) with them. The second row in Demand.txt contains the number of periods of prior demand included in the file. That value should be read and used to size the first dimension of demandValues. The second dimension of demandValues should be specified so that both the month and the demand value can be stored in separate columns. c. Add additional code to readData that reads the month/demand values from Demand.txt and stores them in demandValues. d. Return demandValues. Question 2 Write a public static method called weightedMovingAverageForecast that determines a forecast using the weighted moving average forecasting method. The method should be constructed according to the following instructions: a. The method accepts a single-dimension double array argument called weights argument. weights consists of values between 0 and 1. The sum of all values in weights must be 1. 1 b. The method also accepts a two-dimensional String array argument called demand. Note that the values in the first column of this array are months and the values in the second column are the prior demand values. c. The method returns a two-dimensional String array that contains the forecast determined using the weighted moving average method in the second column of the array and the month associated with each forecasted value in the first column. The forecast value for any period where a forecast cannot be calculated should be specified to be -999. The name of the month in the last period of your forecast should be specified as “Next period”. This resource contains a simple description of the weighted moving average method. https:// denninginstitute.com/modules/dau/stat/mvavgs/wma_frm.html Question 3 Write a public static method called exponentialSmoothingForecast that determines a forecast using the exponential smoothing forecasting method. The method should be constructed according to the following instructions: a. Method accepts a double argument called alpha. b. The method accepts a two-dimensional String array argument called demand. Note that the values in the first column of this array are months and the values in the second column are the prior demand values. c. The method returns a two-dimension String array that contains the forecast determined using the exponential smoothing average method in the second column of the array and the month associated with each forecasted value in the first column. The forecast value for any period where a forecast cannot be calculated should be specified to be -999. The name of the month in the last period of your forecast should be specified as “Next period”. 2 Question 4 Write a MAD calculation method just as we did in class EXCEPT the method should accept two twodimensional String arrays as arguments (one two-dimensional String array will contain the observed demand read from Demand.txt and the other two-dimensional String array will contain forecasted demand values). Both methods still should return a double. Note that this question should require a basic modification to the code we wrote in class MAD. Question 5 Add code to the main method that accomplisheds the following: a. Fills the String array named di declared for you by calling the readData method created in Question 1. b. Generates a forecast using the weightedMovingAverageForecast method using weights = {.25, .75}. Print that forecast to the screen using the printForecast method provided. Determine the MAD for this forecast using the method implemented in Question 4. Print this value to the screen with a label stating what it represents. c. Generates a forecast with the exponentialSmoothingForecast method using α = .4. Print that forecast to the screen using the printForecast method provided. Determine the MAD for this forecast using the method implemented in Question 4. Print this value to the screen with a label stating what it represents.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

This is for java

Question 1
In this question you will create a method in Forecasting.java named readData that reads the data from
Demand.txt located in the input_files directory.
a. Create a static method in Forecasting.java named readData with the following signature specifications:
• access: public
• return type: two-dimensional String array
• arguments: none
b. In the readData method, create a two-dimensional array named demandValues that stores String values.
The first row of Demand.txt contains column headers. readData should read those values in, but
disregard (do nothing) with them. The second row in Demand.txt contains the number of periods of
prior demand included in the file. That value should be read and used to size the first dimension of
demandValues. The second dimension of demandValues should be specified so that both the month
and the demand value can be stored in separate columns.
c. Add additional code to readData that reads the month/demand values from Demand.txt and stores
them in demandValues.
d. Return demandValues.
Question 2
Write a public static method called weightedMovingAverageForecast that determines a forecast using the
weighted moving average forecasting method. The method should be constructed according to the following
instructions:
a. The method accepts a single-dimension double array argument called weights argument. weights consists of values between 0 and 1. The sum of all values in weights must be 1.
1
b. The method also accepts a two-dimensional String array argument called demand. Note that the values
in the first column of this array are months and the values in the second column are the prior demand
values.
c. The method returns a two-dimensional String array that contains the forecast determined using the
weighted moving average method in the second column of the array and the month associated with
each forecasted value in the first column. The forecast value for any period where a forecast cannot be
calculated should be specified to be -999. The name of the month in the last period of your forecast
should be specified as “Next period”.
This resource contains a simple description of the weighted moving average method. https://
denninginstitute.com/modules/dau/stat/mvavgs/wma_frm.html
Question 3
Write a public static method called exponentialSmoothingForecast that determines a forecast using the exponential smoothing forecasting method. The method should be constructed according to the following
instructions:
a. Method accepts a double argument called alpha.
b. The method accepts a two-dimensional String array argument called demand. Note that the values in
the first column of this array are months and the values in the second column are the prior demand
values.
c. The method returns a two-dimension String array that contains the forecast determined using the
exponential smoothing average method in the second column of the array and the month associated
with each forecasted value in the first column. The forecast value for any period where a forecast
cannot be calculated should be specified to be -999. The name of the month in the last period of your
forecast should be specified as “Next period”.
2
Question 4
Write a MAD calculation method just as we did in class EXCEPT the method should accept two twodimensional String arrays as arguments (one two-dimensional String array will contain the observed demand
read from Demand.txt and the other two-dimensional String array will contain forecasted demand values).
Both methods still should return a double. Note that this question should require a basic modification to
the code we wrote in class MAD.
Question 5
Add code to the main method that accomplisheds the following:
a. Fills the String array named di declared for you by calling the readData method created in Question
1.
b. Generates a forecast using the weightedMovingAverageForecast method using weights = {.25, .75}.
Print that forecast to the screen using the printForecast method provided. Determine the MAD for
this forecast using the method implemented in Question 4. Print this value to the screen with a label
stating what it represents.
c. Generates a forecast with the exponentialSmoothingForecast method using α = .4. Print that forecast
to the screen using the printForecast method provided. Determine the MAD for this forecast using
the method implemented in Question 4. Print this value to the screen with a label stating what it
represents.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY