Question: Can I get help with this java project. I have created the following code but I get errors. This is the code package project1; import
Can I get help with this java project. I have created the following code but I get errors. This is the code
package project1;
import java.util.Scanner;
public class harmonicNumber { public static harmonicSum(int h){ if(h == 1){ return 1.0; } else{ return (1.0 / h) + harmonicSum(h - 1); } } public static void main(String[] args){ Scanner scn = new Scanner(System.in); System.out.println(" Enter A Number "); int n = scn.nextInt(); double hsum = harmonicSum(n); System.out.println(" Harmonic sum " + hsum); } } 
2. The n" Harmonic number is the sum of the reciprocals of the first n natural numbers Write a recursive method and accompanying main method to compute the nh Harmonic number (5 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
