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
anzhelika [568]
3 years ago
7

Write convert() method to cast double to int

Computers and Technology
1 answer:
Oksanka [162]3 years ago
3 0

Answer:

Explanation:

The code provided is written in Java. The statement is provided right under the /*Type your code here*/. In Java, in order to case one primitive to another you simply need to type the primitive type that you are trying to cast too before the variable and within parenthesis. The output of the new code can be seen in the attached image below.

class LabProgram {

   public static int convert(double d){

   /* Type your code here */

      return (int) d;

}

public static void main(String[] args) {

System.out.println(convert(19.9));

System.out.println(convert(3.1));

}

}

You might be interested in
A string is represented as an array of characters. If you need to store an array of 5 strings with the maximum length of a strin
erastova [34]

Answer:

char str[5][100]

Explanation:

See attachment for options:

From the options, we can see that the programming language is C language.

The syntax to store an array of m strings with a maximum of n elements in C is:

char array-name[m][n]

In this case:

m = 5 --- Number of strings in the array

n = 100 --- Maximum character in each string

Assume the array name is str, the syntax can be expressed as:

char str[5][100]

3 0
2 years ago
What is the full form of w3c
Xelga [282]
The World Wide Web Consortium, which <span>is an international community where organizations, employees</span><span> and the general public work together to develop Web standards.</span>
7 0
3 years ago
If Scheme were a pure functional language, could it include DISPLAY ? Why or why not?​
VARVARA [1.3K]

Answer:

When Scheme is a pure functional language, it cannot include the function DISPLAY. Since the pure functional languages will return the same value whenever the same expression is evaluated, and the DISPLAY would be the output and thus it cannot be part of the purely functional language. Thus in the pure functional language we can evaluate the expressions with the same arguments and it returns the same value since there is no state to change.

Explanation:

4 0
2 years ago
When you point to defined styles in the cell styles gallery, you can see the formatting that will be used when you apply each st
Dvinal [7]
Hello  <span>Missthang2456 </span>

Question: <span>When you point to defined styles in the cell styles gallery, you can see the formatting that will be used when you apply each style?


Answer: This is true

Hope This Helps!
-Chris</span>
4 0
3 years ago
20 points!!
creativ13 [48]
I think it’s C considering what clip art is, you put in pictures. i’m crying with you
3 0
2 years ago
Other questions:
  • Which of the following formats can algorithms NOT be written in:
    13·1 answer
  • When enter a function or formula in a cell, which is the character you must type?
    14·1 answer
  • Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the p
    12·1 answer
  • How can netiquette help you communicate when texting or instant messaging?
    6·1 answer
  • Which of the following is the answer?
    5·1 answer
  • Create the code that will find
    11·1 answer
  • 1. Briefly explain the concept of signature of a function, in a function declaration. What signature components are crucial for
    9·1 answer
  • Is it better to try to prevent damage from natural disasters or to deal with disasters after they occur?
    10·2 answers
  • 8.10 Code Practice Question 3
    6·1 answer
  • 1 pound is equivalent to how many grams?<br>A.463.59 grams<br>B.10 grams<br>C.59 grams<br>D.5 grams​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!