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
Elanso [62]
3 years ago
7

max is a method that accepts two int arguments and returns the value of the larger one. Four int variables, population1, populat

ion2, population3 and population4 have already been declared and initialized. Write an expression (not a statement !) whose value is the largest of population1, population2, population3 and population4 by calling max. Assume that max is defined in the same class that calls it.
Computers and Technology
1 answer:
Sav [38]3 years ago
3 0

Answer:

Hello, I imagine that you use Java as the programming language since you refer to classes, so I will make a small code that simulates a Java program with the descriptions you need.

public class Example {

 

 

 public int Max(int population1, int population2, int population3, int population4) {

   int max = 0;

   if(population1 > population2 && population1 > population3 && population1 && population4){

       max = population1;

   }

   else if(population2 > population1 && population2 > population3 && population2 && population4){

       max = population2;

   }

   else if(population3 > population2 && population3 > population1 && population3 && population4){

       max = population3;

   }

   else {

       max = population4;

   }

   return max;

 }

 

 public static void main(String[] populations) {

   Example myObject = new Example();

   int population1 = 1;

   int population2 = 2;

   int population3 = 3;

   int population4 = 4;

   int max = myObject.Max(population1,population2,population3,population4);

   System.out.println(max); // 4

 }

}

You might be interested in
HEEELLPPPPP, ILL GIVE THE BRAIN THING
sladkih [1.3K]
Can you explain more please??!
5 0
3 years ago
How does the speaker feel about traditional forms of poetry
Salsk061 [2.6K]
A speaker sometimes is not able to capture the intended details since it is affected by homophones.
7 0
4 years ago
Read 2 more answers
what is the term used when a virus takes control of features on your computer and transports files or information automatically?
Akimi4 [234]

Answer: a "worm"

Explanation:

3 0
3 years ago
Which shortcut key aligns to the center of a page
riadik2000 [5.3K]

Answer:

To make text centered, select and highlight the text first, then hold down Ctrl (the control key) on the keyboard and press E. To make text right aligned, select and highlight the text first, then hold down Ctrl (the control key) on the keyboard and then press R.

Explanation:

4 0
3 years ago
In this exercise we will practice using loops to handle collections/containers. Your job is to write a program that asks the use
kati45 [8]

Answer:

In Python:

chars = 'abcdefghijklmnopqrstuvwxyz'

letter = input("Sentence: ")

for i in range(len(chars)):

   count = 0

   for j in range(len(letter)):

       if chars[i] == letter[j].lower():

           count = count + 1

   if count > 0 :

       print(chars[i]+": "+str(count)+" times")

Explanation:

This initializes the characters of alphabet from a-z

chars = 'abcdefghijklmnopqrstuvwxyz'

This prompts the user for sentence

letter = input("Sentence: ")

This iterates through the initialized characters

for i in range(len(chars)):

This initializes count to 0

   count = 0

This iterates through the input sentence

   for j in range(len(letter)):

This compares the characters of the sentence with alphabet a-z

       if chars[i] == letter[j].lower():

If there is a match, count is incremented by 1

           count = count + 1

If there is an occurrence of character,

   if count > 0 :

The character and its count is printed

       print(chars[i]+": "+str(count)+" times")

5 0
3 years ago
Other questions:
  • When a field is declared static there will be ________. Group of answer choices two reference copies of the field for each metho
    14·1 answer
  • _____ run horizontally and _____ run vertically in a table.
    7·1 answer
  • Assume that an array named salarySteps whose elements are of type int and that has exactly five elements has already been declar
    11·1 answer
  • A frameset should only be used with XHTML true or false
    11·1 answer
  • Select the pieces of information that are added on to data to get it where it is going.
    5·1 answer
  • A(n) ________ is a server-based operating system oriented to computer networking and may include directory services, network man
    5·1 answer
  • Help I will mark BRAINLIEST !<br> Explain looping as an invention strategy. Why is it helpful?
    12·1 answer
  • In which situation would Accenture apply principles of Responsible Artificial Intelligence (AI)?
    9·1 answer
  • If you delete search results, you will a. clear the history on the computer. b. delete files from our computer. c. modify the re
    14·1 answer
  • A device that turns hard copy, such as a paper document, into a digital format that can be viewed or manipulated on a computer i
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!