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
Which of the following best describes the impact of Creative Commons?
Pachacha [2.7K]

Answer:

it’s just a screenie hope it helps

8 0
2 years ago
Which of the following type of software application would open a txt file
kogti [31]
I think that it's A or C
3 0
3 years ago
Read 2 more answers
What is a computer software?​
Fofino [41]

Answer:

Software, instructions that tell a computer what to do The term was coined to differentiate these instructions from hardware  the physical components of a computer system.

Explanation:

6 0
3 years ago
Read 2 more answers
Write method reverseString, which takes a string str and returns a new string with the characters in str in reverse order. For e
son4ous [18]

Answer:

The method written in Java is as follows:

public static String reverseString(String str){

    String result = "";

    int lentt = str.length();

    char[] strArray = str.toCharArray();

       for (int i = lentt - 1; i >= 0; i--)

           result+=strArray[i];

    return result;

}

Explanation:

This defines the method

public static String reverseString(String str){

This initializes the result of the reversed string to an empty string

    String result = "";

This calculates the length of the string

    int lentt = str.length();

This converts the string to a char array

    char[] strArray = str.toCharArray();

This iterates through the char array

       for (int i = lentt - 1; i >= 0; i--)

This gets the reversed string

           result+=strArray[i];

This returns the reversed string            

    return result;

}

<em>See attachment for full program that includes the main method</em>

Download txt
3 0
3 years ago
4.11 lesson practice <br> Need help
NNADVOKAT [17]

Answer:

Computer modeling.

Explanation:

Computational modeling is characterized by the use of computers to represent a real world situation, that is, it is the use of mathematical models to assist in solving problems in multidisciplinary areas essential for the development of science and technology. Through computational modeling it is possible to adjust several study variables and achieve greater probabilities of reaching an effective result more quickly and at a lower cost.

Through this system it is possible to solve complex problems such as scientific research, product development, analysis and predictions about certain phenomena, development of technology applied to health, etc.

4 0
3 years ago
Read 2 more answers
Other questions:
  • A new company is upgrading a media workstation. The computer will be predominantly used for graphic intensive presentations, sli
    13·1 answer
  • What are some situations where you might find it useful to use the “!” symbol in a program?
    9·1 answer
  • Why is it important to begin development of a software solution with a programming design in place? A programming design summari
    11·2 answers
  • The Fibonacci numbers are the numbers
    15·1 answer
  • __________ use a challenge response mechanism in which a server challenges a user with a number, which a user must then enter in
    5·1 answer
  • What is the definition of D1-D4?
    14·1 answer
  • Which of the following feature are parts of Toyota’s safety system?
    10·1 answer
  • What is a column in a table
    10·2 answers
  • MP3 BrainPoP Quiz
    13·2 answers
  • Which of the following is NOT a reason we use subprograms?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!