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
sammy [17]
3 years ago
9

Analyze the following code (in both cases number has been declared and initialized): Code 1: boolean even; if (number % 2 == 0)

even = true; else even = false; Code 2: boolean even = (number % 2 == 0);
Computers and Technology
1 answer:
shusha [124]3 years ago
8 0

Answer:

Both codes are correct.The value of even is true when the number is even.

Explanation:

Code 1:

number %2 ==0 means that when dividing number by 2 is the remainder coming out is zero.If it is true then even becomes is true if it is false then else statement is executes in which even becomes false.Means the number is odd.This code is simple and easy to understand.

Code 2:-

This code is a bit tricky and takes time to understand.even becomes true

when the number is divisible by 0 and false when it is not.

You might be interested in
The button for adding a picture to a spreadsheet is found in the
boyakko [2]
The answer is Insert Tab. This is the button to add a picture to a spreadsheet.  <span>Click </span>Insert to add something to a spreadsheet. This includes pictures, shapes, charts, links, text boxes, video and more. <span>The </span>Insert Tab<span> is used to </span>insert<span>    different features such as tables, pictures, clip art, shapes, charts, page numbers, word art, headers, and footers into a document. </span>
6 0
3 years ago
Which pair of devices have the same input motion and different outputs?
allochka39001 [22]

Answer:

nutcracker and can opener

Explanation:

5 0
3 years ago
Which task might be suitable for moving into a separate function so you can re-use it from multiple places in your code?
Fudgin [204]

Answer:

The answer is "All of these could make good functions ".

Explanation:

In the given question some information is missing, that is options which can be described as follows:

a. Ask the user to confirm an input with a yes/no answer

b. Sort some input data into an ordered list

c. All of these could make good functions

d. Calculate a complex mathematical expression

A method is a collection of ordered code and provides a generic code, that is used to execute a single, connected operation.

  • A good function is a function, which takes values from the user and it will sort all the data and store in memory, and whenever we call the function, it will give the values.
  • It is also used to calculate some complex values,
8 0
3 years ago
Explain steps in creating a main document for from letter. <br>​
Paladinen [302]

Answer:

To create a new database, follow these steps:

1.In the Mail Merge task pane, click Next: Select Recipients.

2.Click Type a new list.

3.Click Create. ...

4.After you type the information for a record, click New Entry to move to the next record. ...

5.In the New Address List dialog box, click OK

4 0
3 years ago
There are 12 inches in a foot and 3 feet in a yard. Create a class named InchConversion. Its main() method accepts a value in in
Dafna1 [17]

Answer:

import java.util.Scanner;

public class InchConversion

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter inches: ");

 double inches = input.nextDouble();

 

 inchesToFeet(inches);

 inchesToYards(inches);

}

public static void inchesToFeet(double inches){

    double feet = inches / 12;

    System.out.println(inches + " inches = " + feet + " feet");

}

public static void inchesToYards(double inches){

    double yards = inches / 36;

    System.out.println(inches + " inches = " + yards + " yards");

}

}

Explanation:

In the inchesToFeet() method that takes one parameter, inches:

Convert the inches to feet using the conversion rate, divide inches by 12

Print the feet

In the inchesToYards() method that takes one parameter, inches:

Convert the inches to yards using the conversion rate, divide inches by 36

Print the yards

In the main:

Ask the user to enter the inches

Call the inchesToFeet() and inchesToYards() methods passing the inches as parameter for each method

7 0
3 years ago
Other questions:
  • Write a program that will askthe user to enter the amount of a purchase. The program should thencompute the state and county sal
    5·1 answer
  • What file may contain data written to it in case of an unexpected error or program shut-down?
    5·1 answer
  • Why is it important to explore an Integrated
    13·1 answer
  • 12. Noodle Tools is a website that
    8·1 answer
  • Upon looking out at the
    8·2 answers
  • Choose the type of error described.
    12·1 answer
  • Select the correct word to complete the sentence.
    8·1 answer
  • There are many best practices for digital recordings. Select the three best practices from the list below. select the best micro
    14·1 answer
  • Given an initialized variable fileName, write a sequence of statements that create a file whose name is given by the variable an
    15·1 answer
  • Assign listNodes with all elements with a clasa name prog-lang
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!