Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description a(n) = | a(1) = 2, n = 1 | a(n) = 4a(n-1)-3n, n >= 2 Given the Maths Function definition above for a

Description

 a(n) = | a(1) = 2, n = 1 | a(n) = 4a(n-1)-3n, n >= 2 

Given the Maths Function definition above for a mathematical function a(n) you are required to write two Java methods both methods will be in the same class.

An iterative method which calculates a(n) for any positive value of n. In this method you must use either a for or a while loop. You should call this method q1Iterative and it should have a definition as follows: public static int q1Iterative(int n)

A recursive method which calculates a(n) for any positive value of n. You should call this method q1Recursive. The definition of the method should be declared as follows: public static int q1Recursive(int n)

Both Java methods should only return the single value of a(n). They should not print any other values.

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions