1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
cupoosta [38]
3 years ago
8

Write a recursive method that takes four inputs: a 1-D array of Strings (i.e., exams), the length of this 1-D array (i.e., n), a

n index to access array elements (i.e., i) and a 2-D array containing double values (i.e., ret).
Computers and Technology
1 answer:
ale4655 [162]3 years ago
5 0

Answer:

import java.util.*;

public class Main

{

       public static void main(String[] args)  

       {

           String [] exams = {"1;2;3;4;" , "5;6;7;8;" , "9;10;11;12;" };

           double[][] n = new double[exams.length][4];

           examArray = convert(exams , exams.length , 0 , n);

           for(int i = 0 ; i < exams.length ; i++)

           {

               for(int j = 0 ; j < 4 ; j++)

               {

                   System.out.print(n[i][j] + "\t");

               }

              System.out.print("\n");

           }

       }    

       

/* recursive function convert defined here */

       public static double[][] convert(String[] exams , int number , int x , double [][] result)

       {

           if(x==number)

               return result;

           else

           {

               String total = exams[x];  

               String currentScore = "";

               int p = 0;

               for(int j = 0 ; j<totalScore.length() ; j++)

               {

                   char ch = total.charAt(j);/

                   if(ch==';')

                   {

                       result[x][p] = Double.parseDouble(currentScore);

                       p++;

                       currentScore = "";

                   }

                   else

                   {

                       currentScore = currentScore + Character.toString(ch);

                   }

               }

               return convert(exams , number , x+1 , result);

           }

           

       }

}

Explanation:

The Java source code defines a recursive function or method called convert that converts the results of three students that sat for four examinations to double or float number and screens their individual results for the four exams on the screen.

You might be interested in
Match the crew members with the equipment or tasks they handle.
vovikov84 [41]

Answer:

Boom operator- Microphone

Director of photography- video camera

Art Director- lighting

Gaffer- set building

8 0
3 years ago
. What process skill would a scientist use to find the length of a line
Brilliant_brown [7]

Answer:

Explanation:

A ruler

;););););););););););););););)

7 0
3 years ago
How many times will the loop body execute:
Xelga [282]
I’d also say B, which is 2
6 0
3 years ago
Differentiate Between<br>Master file and transaction file<br>​
Ray Of Light [21]

Answer: money

Explanation: money is life and the air is fat is full of fart

5 0
3 years ago
Read 2 more answers
What is 11.2 rounded to the nearest one?​
klio [65]
Your answer is already in one decimal place. If you consider the whole number to one decimal place it would be rounded to just 10 since 0 doesn’t count for sig figs. Hope it helped
4 0
3 years ago
Read 2 more answers
Other questions:
  • What term refers to a piece of software that interfaces with the hardware on your computer?
    10·2 answers
  • You have a site (Site1) that has about 20 users. For the last few months, users at Site1 have been complaining about the perform
    9·1 answer
  • What is the term used when a password is obtained through tricking a user into giving it to another party?
    15·1 answer
  • Choose and explain, step by step, one method of backing up student files either manually or using a cloud service.
    10·1 answer
  • Explain the Decision making statement​
    15·1 answer
  • What is the function of a breadcrumb trail in a website?
    13·1 answer
  • Charles was supposed to present his PowerPoint slides to his classmates in a classroom, but now he has to present in the auditor
    12·2 answers
  • I have this questions i need to make it in a report format pages of atleast 3 pages and maximum of 5 pages​
    7·1 answer
  • Use the table on the right to convert from binary to decimal.
    11·2 answers
  • How many ways are used to insert an image from file?koi h kya​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!