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
An engine's _______ contains the cylinder block, the cylinders, the piston, the connecting rods, and the crankshaft assemblies.
Fittoniya [83]
The answer is C.upper end

hope this helps. Have a wonderful day 
5 0
3 years ago
Read 2 more answers
Algorithm and flowchart to find the perimeter and area of square​
kupik [55]

Answer:

I can give you the perimeter "algorithm" but not the flowchart.

Here you go:

p = w * 4

p = perimiter,

w = width/height

4 = the amount of sides needed.

perimeter = width * 4

to include both width and height, we would instead use:

perimeter = 2(width+height)

This also works with rectangles ^

--------------------------------------------------------------------------

To find an area, it is just width * height. This is also compatible with rectangles.

4 0
3 years ago
Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s s
statuscvo [17]

Answer:

I think it was about cheaper ads on Instagram and how they are lowering their prices.

Explanation:

6 0
3 years ago
Read 2 more answers
1) what are two functions of a pick or count condition?
viktelen [127]
1.  The best option is C) pick an object at random, and keep track of how many copies of an object are left in a game.
2.   The best option is D) clockwise and counterclockwise.
3.    your 3rd question does not seem to be clear to me.
3 0
3 years ago
Consider the security of a mobile device you use
Alekssandra [29.7K]

Answer:

keep it private

Explanation:

7 0
2 years ago
Other questions:
  • What is the central unit of the computer that contains the logic circuitry and carries out the instructions of the computer's pr
    13·1 answer
  • Effective presentations vary the color scheme on each slide.<br><br> True<br> False
    5·2 answers
  • Directory servers from different vendors are synchronized through ________.
    9·1 answer
  • Enter the answer.
    11·2 answers
  • Select the correct answer.
    12·2 answers
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • g Write a function named vowels that has one parameter and will return two values. Here is how the function works: Use a while l
    9·1 answer
  • Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
    11·2 answers
  • Write a Pascal program that will prompt the user to enter the radius of a circle.
    9·1 answer
  • If you give someone ______ to your device, they can control it through another phone or computer.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!