I already have the code for the assignment below, but the code has an error in the driver class. Please help me fix it. The assignment: Make a recursive method for factoring an integer n. First, find a factor f, then recursively factor n / f. This assignment needs a resource class and a driver class. The resource class and the driver class need to be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code The code of the resource class: import java.util.ArrayList; import java.util.List; public class U10E03R {     // Recursive function to     // print factors of a number    public static void factors(int n, int i)    {             // Checking if the number is less than N       if (i <= n) {          if (n % i == 0) {             System.out.print(i + " ");          }                    // Calling the function recursively             // for the next number          factors(n, i + 1);       }    } }   The code of the driver class: public class U10E03D {    public static void main(String args[])    {       int N = 16;       factors(N, 1);    } }   The error is shown in the picture I attached, please have a look at it.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I already have the code for the assignment below, but the code has an error in the driver class. Please help me fix it.

The assignment:

Make a recursive method for factoring an integer n. First, find a factor f, then recursively factor fThis assignment needs a resource class and a driver class. The resource class and the driver class need to be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code

The code of the resource class:

import java.util.ArrayList;
import java.util.List;

public class U10E03R
{

    // Recursive function to
    // print factors of a number
   public static void factors(int n, int i)
   {
   
        // Checking if the number is less than N
      if (i <= n) {
         if (n % i == 0) {
            System.out.print(i + " ");
         }
      
            // Calling the function recursively
            // for the next number
         factors(n, i + 1);
      }
   }
}

 

The code of the driver class:

public class U10E03D
{
   public static void main(String args[])
   {
      int N = 16;
      factors(N, 1);
   }
}

 

The error is shown in the picture I attached, please have a look at it.

 

1 public class U10E03D
2 {
public static void main(String args[])
{
int N = 16;
factors(N, 1);
U9E02R.class
U9E02D.java
U9P08R.java
U9P08D.java
U9P07R.java
| U9P07D.java
U10E03R.java G U10E02R.j
Compile Messages
JGRASP Messages
Run VO Interactions
Stop
L ----JGRASP: operation complete.
----JGRASP exec: javac -g U10E03D.java
U10E03D.java:6: error: cannot find symbol
factors(N, 1);
Clear
Copy
symbol:
method factors(int,int)
location: class U10E03D
1 error
---JGRASP wedge2: exit code for process is 1.
--JGRASP: operation complete.
Transcribed Image Text:1 public class U10E03D 2 { public static void main(String args[]) { int N = 16; factors(N, 1); U9E02R.class U9E02D.java U9P08R.java U9P08D.java U9P07R.java | U9P07D.java U10E03R.java G U10E02R.j Compile Messages JGRASP Messages Run VO Interactions Stop L ----JGRASP: operation complete. ----JGRASP exec: javac -g U10E03D.java U10E03D.java:6: error: cannot find symbol factors(N, 1); Clear Copy symbol: method factors(int,int) location: class U10E03D 1 error ---JGRASP wedge2: exit code for process is 1. --JGRASP: operation complete.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education