Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here what I have so far in java, import java.io.File; import java.io.FileNotFoundException; import java.util.*; import java.io.*; public class forecast { //this is the main method

here what I have so far in java,

import java.io.File; import java.io.FileNotFoundException; import java.util.*; import java.io.*; public class forecast { //this is the main method to print the required 2 D array public static void main(String[] args) throws FileNotFoundException { String[][] read=readData(); //this will print the required data for (String[] str:read){ System.out.println(str[0]+" "+str[1]); } int numWeights; Scanner sc = new Scanner(System.in); numWeights = sc.nextInt(); List weights = new ArrayList(); sc = new Scanner(System.in); Double wts; for(int i=0;i weights, String data[][]) { int forecastspan = weights.size(); //System.out.println(data.length); // we have more weights than number of months return -999 if(weights.size()>data.length) return -999.0; Double weightedValue = 0.0; for(int i = data.length-1;i>=data.length -forecastspan; i--){ weightedValue+= Double.parseDouble(data[i][1])*weights.get(i-data.length+forecastspan); } return weightedValue; } public static String[][] readData() throws FileNotFoundException { File file=new File("Demand.txt"); //this is the readData method which is required //here we will scan the txt file Scanner scanner=new Scanner(file); scanner.nextLine(); int size=scanner.nextInt(); /ow we will store line by line content of textfile into the 2D array. String[][] demandValues=new String[size][2]; for (int i=0;i 

image text in transcribed

Write a public static method called exponentialSmoothing Forecast that determines a forecast using the ex- ponential 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. 1 - CN 4. 5 month demand 7 January 15 February 9 March 7 April 6 May 3 June 5 July 8 6. 7. 8. 9 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What are metadata? Why is it important to manage metadata?

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago