Question: Program 1:Fibonacci.java F1= 1 , F2 = 1, F3= F1 + F2program that will output a range of Fibonacci numbers.Start by asking the user the

Program 1:Fibonacci.java

F1= 1 , F2 = 1, F3= F1 + F2program that will output a range of Fibonacci numbers.Start by asking the user the lower and upper bounds for values in the sequence.Such as (lower = 6th value, upper = 10th value) would correspond to values [ 8, 13, 21, 34, 55 ].static function that will return an integer value of a single Fibonacci number.This static method should take an integer that represents which value in the sequence we are computing and returns an integer of that value.The formula will calculate this but you will have to cast it to be an integer.Use a loop in the main to call that method repeatedly and output the results one at a time until the numbers of values meets the list the user asked for. Note: method does not output and only returns one value!

this is what I did so far:

import java.util.Scanner;

class Fibonacci{

public static void main(String[] args){

System.out.print("Please enter the lower bound that you want to begin fibonacci sequence: ");//ask lower bound for fibonacci sequencein the Fibonacci Series*/

Scanner keyboard = new Scanner(System.in);

int minNumber, maxNumber; //previousNumber = 0, nextNumber = 0; //declare the variables

minNumber = keyboard.nextInt();

System.out.print("Please enter the Upper bound that you want to end fibonacci sequence: ");//ask upper bound for fibonacci sequence

maxNumber = keyboard.nextInt();

System.out.println("Your values are: ");

int list = fibSeq(minNumber, maxNumber);

System.out.println(list);

Program 2:PickWord.java

program that will ask the user to input a phrase (multiple word sentence), and an integer value.A static function will be created that takes the sentence (string) and integer as input parameters and returns a single word (string) of that sentence.If the integer was the number three, then the word returned would be the third word in the sentence.If the integer given in zero or negative, simply return an empty string. (do not let it crash) If the integer given is higher than the number of words in the sentence, then just return the last word.The main will ask the user for the inputs, show the output and will give the user the choice to enter in new information (repeatable).This should repeat until the user says that they are done.The static function will not have any inputting or outputting, it simply finds the word and returns it to the main as a string.Do not use StringTokenizer to break up string and do not use the split method from the String class.I want you to do the hard work of searching for spaces between words.You may assume each space in the input is the transition between words.This means that adding multiple spaces between words will mess with your count of words.

this is what I did so far:

import java.util.Scanner;

import java.util.*;

class PickWord{

public static void main(String[] args){

//String phrase;

System.out.print("Please type a phrase: ");

Scanner scan = new Scanner(System.in);

String phrase = scan.nextLine();

System.out.print("Please enter a number: ");

Scanner keyboard = new Scanner(System.in);

int number = keyboard.nextInt();

do{

int index = chooseWord(phrase, number);

System.out.println(index);

System.out.print("Please type a phrase: ");

phrase = scan.nextLine();

System.out.print("Please enter a number: ");

number = keyboard.nextInt();

}//end do

while(!phrase.equals("done"));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!