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
sdas [7]
3 years ago
14

The divBySum method is intended to return the sum ofall the elements in the int arrayparameter arr that are divisible by the int

parameter num. Consider the following examples, in whichthe array arrcontains {4, 1, 3, 6, 2, 9}.The call divBySum(arr, 3) will return 18,which is the sum of 3, 6, and 9,since those are the only integers in arr that aredivisible by 3.The call divBySum(arr, 5) will return 0,since none of the integers in arr are divisibleby 5.Complete the divBySum method using anenhanced for loop. Assume that arr isproperly declared and initialized. The method must use anenhanced for loop to earn full credit./** Returns the sum of all integers inarr that are divisible by num* Precondition: num > 0*/public static int divBySum(int[] arr, int num)
Computers and Technology
1 answer:
charle [14.2K]3 years ago
4 0

Answer:

Explanation:

The following program is written in Java and creates the divBySum method using a enhanced for loop. In the picture attached below I have provided an example of the output given if called using the array provided in the question and a divisible parameter of 3.

public static int divBySum(int[] arr, int num) {

       int sum = 0;

       for (int x : arr) {

           if ((x % num) == 0) {

               sum += x;

           }

       }  

       return sum;

   }

You might be interested in
2. (8 points) When creating the Academic Database, there were several instances of data
Bad White [126]

Answer:

See explaination

Explanation:

An Academic Database deals with the information pertaining to the records of students of an institute. The various fields which can be associated with a student are Name, Unique Identification Number, Marks in various subjects, Grades, Courses Taken and so on. Most of the fields mentioned above have some or other form of validation that is required for the DB to be consistent and follow the basic properties of a database.

One field where range validation can be used is MARKS. In the marks field, the range of marks will be say 0 to 100 and anything below 0 or above 100 must be reported to the database administrator. Another field where we can apply a range validation is AGE in which the range of age allowed could greater than say 10, if it is a college and maximum age could be say 60. Thus, the range check on the AGE field is 10 to 60.

One field where choice validation can be used is GENDER. In the gender field, there could be multiple choices like Male, Female and Others. Thus, out of the available choices we have to select only the available choice and only one choice must be selected where we can apply choice validation. Another field is COURSE, where we can have a list of courses a student can opt for and out of the available courses can select one.

Thus, there are multiple fields where we can apply various types of validation and it is important to explore the area for which the DB has been created understanding all the scenarios and attributes of the problems that are associated with that area.

8 0
4 years ago
What will be the output of the following code? <?php $foo = 'Bob'; $bar = $foo; $bar = "My name is $bar"; print $bar; print $
SCORPION-xisa [38]

Answer: b. My name is BobBob

Explanation:

  • $foo = 'Bob'; // Assigns foo variable the value Bob
  • $bar = $foo; // Assigns the value of foo to bar
  • $bar = "My name is $bar"; //changes the $bar this is the way to  include variables directly in the string.
  • print $bar; // this prints My name is and moves to the variable $bar which prints the value of $bar which is the value of $foo i.e. Bob
  • print $foo; // prints another Bob
7 0
3 years ago
Read 2 more answers
Please help meeee , you will get 20 points
docker41 [41]

Answer:

true

Explanation:

true trueee 3uehehehdgeyeyehhehehegegegrhrtggrevegrgrhehehru

5 0
3 years ago
Read 2 more answers
A browser is an example of a. :
UNO [17]
A browser is an example of a system application
5 0
3 years ago
You have several marketing documents that are published through AD RMS. However, you have three new marketing employees that req
snow_lady [41]

Answer:

Document unauthorized

Explanation:

this way new employees will not try to open

5 0
3 years ago
Other questions:
  • Which are considered regulatory agencies? Check all that apply. WHO PPO HMO CMS CDC NIOSH
    11·2 answers
  • A media scholar is trying to find out whether internet or television political ads are more persuasive. what kind of effects is
    7·1 answer
  • Which of the following are not deducted on a typical pay stub
    12·1 answer
  • Which type of financial institution typically has membership requirements?
    14·1 answer
  • Can you be my friend plz
    9·1 answer
  • Derive the three-dimensional transformation matrix for scaling an object by a scaling factor s in a direction defined by the dir
    15·1 answer
  • Employing the use of a(n) <br> will help you manage a STEM project.
    13·1 answer
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    5·1 answer
  • Can you please help me
    9·1 answer
  • My messaging system is messed up. It keeps saying I'm getting messages but then it says nothing new in my inbox. I'm confused- H
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!