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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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