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
makvit [3.9K]
3 years ago
15

Implement a recursive java method to find the sum of the first n int's in a java int array. Max size 20.

Computers and Technology
1 answer:
oee [108]3 years ago
6 0

Solution:

public class SumOfArray {

private int[] a;

private int n;

private int result;

   public int sumOfArray(int[] a,int n) {

     this.a = a;//Max size is 20

     n = a.length;

     if (n == 0)  // base case

     return a[n];

     else

         return a[n] + sumOfArray(a, n-1);

     return result;

  } // End SumOfArray method

} // End SumOfArray Class  


You might be interested in
My computer screen keeps flashing black, it's on a very low brightness level and I very rarely put it up to high level unless I
mihalych1998 [28]
If your computer is old it may be the screen is dying or if its brand new it would probably  be the power supply check your battery or cables
6 0
3 years ago
Read 2 more answers
Give a detailed example of how an app (that you use regularly)uses parameters. You must state the app's name and function, the p
sesenic [268]

Answer:

mobile calculator

Explanation:

The mobile calculator application is a mobile software on phones and other computer devices that returns the answer to a calculation given the operands and opcode specified by the user.

5 0
2 years ago
I'm 11, except my profile says I'm 15.
aleksandr82 [10.1K]

Answer:

Hello there, I dont think there is a way to change you age, but maybe you shall try again tomorrow and see if an error message pop up.  If the Error Message pops up, contact custumaor support!

Glad I could Help!

3 0
3 years ago
A file to which information is written is referred to as a(n) ____ file.
Iteru [2.4K]
The answer is <span>output.  </span>A file to which information is written is referred to as an output file.  It is  <span>a computer </span>file<span> that contains data that are the </span>output<span> of a device or program. </span>
4 0
3 years ago
Write a function that asks a user for his/her name and movie
Alex777 [14]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

                     

The code is written in C++

/******************************************************************************

                             Online C++ Compiler.

              Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

#include <string>  

using namespace std;

void display()

   {

       string yourName;

       string watchedMovie;

       cout<<"What is your name?  ";

       cin>>yourName;

       cout<<"Which movie have you seen?  ";

       cin>>watchedMovie;

       cout<<"Today, I have learned that  " <<name<<" watched "<<watchedMovie<<" movie";

   }

int main()

{    

   

   display();

   return 0;

}

 

7 0
3 years ago
Other questions:
  • What are the planes used to allow SDN to virtualize parts of the physical network so that it can be more quickly and easily reco
    6·1 answer
  • The countryside presents
    11·1 answer
  • What data discovery process, whereby objects are categorized into predetermined groups, is used in text mining?
    12·1 answer
  • Jane is creating a slide that will have a large heading and number of bullet points below it. What slide format should she use?
    12·1 answer
  • A computer essentially takes input, processes it, and produces output. Which person developed a machine in the mid-1880s that ac
    6·1 answer
  • What does an operating system do?
    12·1 answer
  • Add the following method to the Point class: public double distance(Point other) Returns the distance between the current Point
    12·1 answer
  • Jonas is creating a presentation for students about volunteering. He wants to begin by speaking about the various opportunities
    11·1 answer
  • True or False <br> Hebrew Bible and the Koran were first written in English.
    15·1 answer
  • What is the result of the following code?<br><br> x=7//2+10%2**4<br><br> print(x)
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!