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
Analyze the following code:
user100 [1]

Answer:

Constructor issue

Explanation:

When you look at the Class A, the constructor takes one argument as a parameter, a String.

A(String newS) {

s = newS;

}

However, in the main, the constructor does not take any argument as a parameter.

A a = new A();

That's why the code does not compile.

5 0
3 years ago
I WILL UPVOTE!!!!!!!!!!!!!!!!!!
BabaBlast [244]
All of the answers above are correct
5 0
3 years ago
When computers are connected and operate through one main computer, it is called a _________ network
adoni [48]
It might be a LAN or Host network. I'm not sure about your question, but your answer might reside in your notes for this class. 
6 0
3 years ago
Read 2 more answers
How old am i <br> (Will give brainliest)
diamong [38]
You’re probably thirteen
4 0
3 years ago
When it comes to having certain sales skills as a hotel manager, being able to really hear, learn about, and show customers that
Tju [1.3M]

Answer:

Communication

Explanation:

The ability to communicate clearly when working with customers is a key skill because miscommunications can result in disappointment and frustration. The best customer service professionals know how to keep their communications with customers simple and leave nothing to doubt.

7 0
2 years ago
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • Mm
    10·1 answer
  • During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. the ram modules
    14·1 answer
  • Gps receivers are commonly used by individuals to determine their geographic location while hiking and to obtain driving directi
    5·1 answer
  • What formula would you enter to add the values in cells b4, b5, and b6?
    10·1 answer
  • Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an inter
    7·1 answer
  • Allie is working on the development of a web browser and wants to make sure that the browser correctly implements the Hypertext
    7·1 answer
  • Please help thank you !!!
    7·2 answers
  • List any two characteristics of ASCC.​
    5·2 answers
  • High-level languages must be translated into machine language before they can be executed. _________________________
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!