QuestionQuestion

1. Write a Java application that uses recursion to compute the results of the following series: The program should compile and run without errors.
m(i) = 1 + 1/2 + 1/3 + 1/4 + 1/5 … + 1/i

2. Write a Java application that effectively uses Java collections to store pairs of unique colors and their unique hexadecimal values. (For example, Red -> FF0000). Store up to 20 of these pairs. Then write a GUI that displays the hexadecimal values using radio buttons to select a value. When selected the background of the GUI should change to that color. The program should compile and run without errors.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;


public class RecursiveSeries {

public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int i;
System.out.print("Please enter in the value of i: ");
i = input.nextInt();
double total = recursive(i);

System.out.println("The result = " + total);

}

public static double recursive(int i)
{
double total = 0;
if(i > 0)
{
total = 1/(double)i;
total += recursive(i-1);
}
return total;
}
}...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats