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
When is padding required for a structure type variable? Group of answer choices When the structure contains a word-type variable
yarga [219]

Answer:When the structure contains a word-type variable, such as integer, float, and pointer, and the total number of bytes is not a multiple of four ---A

Explanation:Structure padding is the assigning of members of a structure to appear at the correct byte boundary. To achieve this, padding is added by a complier so that structure members can appear in thier correct location, taking into consideration also the size of the structure which must be arranged orderly to the memory so that the padding can reoccur at the end of the structure.

For example--

For a structured type variable, padding is required when the structure contains a word-type variable, such as integer, float, and pointer, and the total number of bytes ie depending on the type of byte fed into the memory for the specific purpose.

6 0
3 years ago
Apache web server is the most widely used network operating system used on web servers.
Zarrin [17]
The statement that Apache web server is the most widely used network operating system used on web servers is true. This server runs on <span>67% of all webservers in the world</span>
The Apache web server is a free and open-source cross-platform HTTP Server,<span> developed and maintained by </span>Apache Software Foundation.
7 0
3 years ago
Read 2 more answers
What is Gamekit Loa3's all questsions
Stells [14]
Video games and currency premium playing
4 0
4 years ago
What are the components of computer system??<br>​
FinnZ [79.3K]

There are Mainly Five basic Components of a computer system.

Input Unit.

Output unit.

Memory Unit.

Control unit.

Arithmetic and Logic Unit.

8 0
3 years ago
Read 2 more answers
Hello hello . please help me​
adelina 88 [10]

Answer:

#include <iostream>  

using namespace std;  

int main()  {  

 int num, check=0;  

 for(int num = 1; num<=100;num++){

for(int i = 2; i <= num/2; i++)  {

     if(num % i == 0)   {  

         check=1;  

         break;         }     }  

 if (check==0)  {       cout <<num<<" ";     }

 check = 0;

 }

 return 0;  

}

Explanation:

This line declares num as integer which represents digits 1 to 100.

A check variable is declared as integer and initialized to 0

<em>  int num, m=0, check=0;   </em>

This for loop iterates from 1 to 100

 for(int num = 1; num<=100;num++){

This iterates from 2 to half of current digit

for(int i = 2; i <= num/2; i++)  {

This checks for possible divisors

     if(num % i == 0)   {  

If found, the check variable is updated to 1

         check=1;  

And the loop is terminated

         break;         }     }  

The following if statement prints the prime numbers

 if (check==0)  {       cout <<num<<" ";     }

 check = 0;

 }

5 0
3 years ago
Read 2 more answers
Other questions:
  • The common field cricket chirps in direct proportion to the current tem­perature. Adding 40 to the number of times a cricket chi
    14·1 answer
  • Which one of the following is not the name of a 20th century school composition
    14·2 answers
  • She thinks it is a good idea to list the gasses bass ed on the the gas found in the atmosphere ...
    12·1 answer
  • Consider the following 32 bit binary representation of the value using IEEE 754 single precision floating point representation.
    15·1 answer
  • "Select the computing device that uses a limited version of an operating system and uses a web browser with an integrated media
    12·1 answer
  • Which of the following is a scam in which a perpetrator sends an official looking e-mail that attempts to obtain a user’s person
    7·2 answers
  • A user has called the company help desk to inform them that their Wi-Fi enabled mobile device has been stolen. A support ticket
    13·1 answer
  • Since we know that this particular instance of the AppMaker implements a customer-facing store that processes financial transact
    6·1 answer
  • Using the drop-down menu, complete these sentences to describe algorithms. Algorithms are instructions to solve a problem. Algor
    12·2 answers
  • What are the importance of rules in the computer lab ?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!