Calculate the nth term passed into the method save the


Please You need this to be done in java.

1. Implement identifySequence method to determine the type of sequence (arithmetic or geometric) .Return the appropriate enumeration value. Save the value of the sequence type in the instance attribute.

If the data is invalid throw an InvalidDataException

2. Calculate the nth term passed into the method. Save the value of the term in the instance attribute.

If the data was invalid or we haven't calculated the data yet, throw the InvalidStateException

Create and evaluates an array of integers to determine if they are a sequence and which type. If a sequence, it calculates the value at the requested term index. Calling this method resets an previous state information.

Calculate the nth term if it is a valid sequence. Use the appropriate formula depending on whether it is arithmetic or geometric.

Return the SEQUENCE_TYPE type

User will call getCalculatedTerm to retrieve the term.

package week02;

import week02.SequenceIdentifier.SEQUENCE_TYPE;

public class SequenceIdentifier {

public class SEQUENCE_TYPE {

public static final SEQUENCE_TYPE ARITHMETIC = null;
public static final SEQUENCE_TYPE GEOMETRIC = null;
public static final SEQUENCE_TYPE NONE = null;

}
/*
public enum SEQUENCE_TYPE {

ARITHMETIC, GEOMETRIC, NONE

}*/

public SEQUENCE_TYPE identifySequence(int[] m_array, int m_termIndex) {


return null;
}

public int getCalculatedTerm() {
// TODO Auto-generated method stub
return 0;
}

public SEQUENCE_TYPE getSequenceType() {
// TODO Auto-generated method stub
return null;
}

}

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Calculate the nth term passed into the method save the
Reference No:- TGS02892352

Expected delivery within 24 Hours