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
Gnoma [55]
2 years ago
11

Write code to define a function named mymath. The function has three arguments in the following order: Boolean, Integer, and Int

eger. It returns an Integer. The function will return a value as follows: 1. If the Boolean variable is True, the function returns the sum of the two integers. 2. If the Boolean is False, then the function returns the value of the first integer - the value of the second Integer.
Computers and Technology
1 answer:
saveliy_v [14]2 years ago
7 0

Answer:

public class Main

{

public static void main(String[] args) {

Main m=new Main();

System.out.println(m.mymath(true,5,2)); // calling the function mymath

}

public int mymath(boolean a,int b,int c) // mymath function definition

{

if(a==true)

{

int d=b+c;

return d;

}

else{int e=b-c;

return e;

}

}

}

You might be interested in
Google is an example of a(n):
bixtya [17]
It would B, because anytime you search it always pulls up google search engine.
8 0
3 years ago
Read 2 more answers
Imagine you had a learning problem with an instance space of points on the plane and a target function that you knew took the fo
gavmur [86]

Answer:

The answer is nearest-neighbor learning.

because nearest neighbor learning is classification algorithm.

It is used to identify the sample points that are separated into different classes and to predict that the new sample point belongs to which class.

it classify the new sample point based on the distance.

for example if there are two sample points say square and circle and we assume some center point initially for square and circle and all the other points are added to the either square or circle cluster based on the distance between sample point and center point.

while the goal of decision tree is to predict the value of the target variable by learning some rules that are inferred from the features.

In decision tree training data set is given and we need to predict output of the target variable.

Explanation:

5 0
3 years ago
Write a program that reads an integer and determines and prints whether it's odd or even. [Hint: Use the remainder operator (%).
Sloan [31]
<h2>Explanation:</h2>

The source code, written in Java, and a sample output have been attached to this response. It contains comments explaining certain parts of the code.

A few things to note are;

(i) The Scanner class is imported to allow user's interact with the program. This is done by writing the import statement at the top of the code as follows;

<em>import java.util.Scanner;</em>

<em />

(ii) An object of the Scanner class is created to receive inputs from the user. The object is called input and created as follows;

<em>Scanner input = new Scanner(System.in);</em>

(iii) Since the user is expected to enter an integer, the nextInt() method of the Scanner object is used to receive the integer and this is saved in a variable called <em>number. </em>i.e

<em>int number = input.nextInt();</em>

<em></em>

(iv) A number x, is even if its remainder when divided by 2 is 0. i.e

if x % 2 = 0, then x is even. Otherwise it is odd.

The user's input received and saved in a variable called <em>number </em>is then checked using if and else blocks to check if it is even or not and can be written as follows;

<em>if(number % 2 == 0){</em>

<em>    System.out.println(number + " is even");</em>

<em>}else {</em>

<em>    System.out.println(number + " is odd");</em>

<em>}</em>

4 0
3 years ago
The type of connection that is kept open after an HTTP request to the server.
Igoryamba

Answer: Persistent

Explanation:

 Persistent is the type of connection in the hyper text transfer protocol (HTTP) that act as communication channel in the network. It basically remain open after HTTP request or response to the server.

Persistent also maintain the HTTP connection and prevent it from the timing out with the help of transmission control protocol packets.

In the persistent connection, after request has been send TCP connection is leave by the server. Therefore, the request can be easily send between the similar server and client.

6 0
3 years ago
When typing using the number row, your ___________________ is the proper finger to key the "6" key.
bazaltina [42]

Answer:

your left pointer finger

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Test if a password entered is correct. The secret phrase is Ada Lovelace. Sample Run 1 Enter the Password: Ada Lovelace Sample O
    13·1 answer
  • Someone is retiring next year. What would be an appropriate amount of risk to take their investments?
    8·2 answers
  • Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
    13·2 answers
  • The use of public wireless connections can increase a user's vulnerability to monitoring and compromise. ____________ software c
    15·1 answer
  • Express the following Boolean function using only the NOT and the AND operation
    6·1 answer
  • Molly, a technician, has been tasked with researching an emulator for the software developers to test cross-platform application
    13·2 answers
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • The intellectual property right that gives a creator control of his or her written work is known as what?
    9·1 answer
  • Find an interesting case on the concept of intellectual property
    14·1 answer
  • 8. Choose the 3 correct statements for the code below.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!