Calculate the nth term passed into the method

Assignment Help JAVA Programming
Reference no: EM132098896

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;
}

}

Reference no: EM132098896

Questions Cloud

Create a gui application that allows the user to calculate : A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected.
Write an oop program to store integers into a linked list : Write an OOP program to store integers into a linked list. Add code so that the linked list sorted.
Calculate and return the tip on a restaurant bill : Write a C# function called calcTip to calculate and return the tip on a restaurant bill.
Determine whether a given number is an armstrong number : Write a WinMIPS64 / EduMips64 code to determine whether a given number is an Armstrong number.
Calculate the nth term passed into the method : Calculate the nth term passed into the method. Save the value of the term in the instance attribute.
Calculate the total costs of the meals : Create an application such that when the user clicks a button, your program will first input 2 meal prices from the user.
How many bits were used to store each character : How many bits would it take to represent all of the lowercase letters in the Latin alphabet used for English?
Calculate the result of each arithmetic expression : Write a java program to validate and calculate the result of each arithmetic Expression from input file.
Advantage of using the switch statement over : In what circumstances would a programmer use if-then-else instead of if-then? Also, What is the advantage of using the switch statement over a series.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Your task for this project is to design a program to help a

your task for this project is to design a program to help a videorental store operatorrecord clients transactions. the

  Create a separate class for your stack

The purpose of the stack is to check an expression involving parentheses, braces, & brackets and determine whether they are balanced

  Mean and standard deviationwrite a program that reads a set

mean and standard deviation.write a program that reads a set of floating-point data values from the input. when the

  Quadratic that solves quadratic equations

Write a method called quadratic that solves quadratic equations and prints their roots. Recall that a quadratic equation is a polynomial equation in terms of a variable x of the form ax2 + bx + c = 0. The formula for solving a quadratic equation is ?..

  Assume an ideal gas mixture is in contact with water

Assume an ideal gas mixture is in contact with water. Determine the equilibrium concentration of the contaminant in the liquid is the gas stream is composed of 200 ppm of benzene in air

  Disadvantages to using data structures

How are data structures managed and organized in this language. How does the management or syntax of data structures in this language differ from how data structures are handled in other language.

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

  Create appropriate packages for all classes

Requirements listed using Java programming code only. You must use the concepts we work on in class. All code must be fully commented

  Display a welcome message to your user

Write a one screen description of your initial reactions to Java. Reactions may be both positive and negative. At the end of this module you will be asked to write a reply to these initial reactions.

  Initialize an array

Which will legally declare, construct, and initialize an array?

  Write an application bmicalc

Write an application (BMICalc) that reads the user's weight in poinds and height in inches, then calculates the Body Mass Index.

  Write a simple program that uses the class

Write a simple program that uses the class. It should prompt the user to input a string, display it, call one or the other of the class functions to convert it, then display the converted string.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd