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 person who has a been exposed to technology at a young age is?
Dahasolnce [82]
Ok if lets say a young child at the age of like 6-7 was allowed to play grand theft auto by his/her parents maybe the child would understand incorrectly and start doing what the people do in the game this may cause to serious trouble jail time or even death. In this case dont let your kids play underrated games or watch underrated movies.
Hope that helped you understand more.
7 0
3 years ago
HIGH POINTS!!! <br>List the creation date of each gaming console to exist.​
ANEK [815]

Answer:

Explanation:

The original Xbox: November 15, 2001

The original PS1: December 1, 1994

Xbox 360: November 22, 2005

Ps2: March 4, 2000

Ps3: November 11, 2006

Xbox One: November 22, 2013

Ps4: November 15, 2013

Nintendo Ds: November 21, 2004

Nintendo 3ds: February 26, 2011

Gameboy: April 21, 1989

Nintendo Switch: March 3, 2017

7 0
3 years ago
In 3–5 sentences, describe the unique challenges e-mail presents for business communications.
alina1380 [7]
One of the things that are a challenge, is that you have to get the correct puntuation, correct capitilization, because it's a buisness email. You ont want to mess a buisness email up. You also have to have no repating phrases and sentences. You can't be adding random words and saying "and" all the time. 
7 0
3 years ago
Read 2 more answers
Name four reasons for keeping your money in a financial institution.
nevsk [136]
1) safety
2) you can collect interest
3) helps you save your money instead of just spending all the time
4) you can gain exponential growth which then can contribute to you.gaining more retirement money when u get older
4 0
2 years ago
Read 2 more answers
Allocate 100 integers and assign the resulting pointers to the elements of ip_arr. Initialize each integer value to -1.
dmitriy555 [2]

Answer:

#include <iostream>

using namespace std;

int main() {

   int *ip_arr,n;//pointer name inp_arr and integer n to store the size.

   cin>>n;//size.

   for(int  i=0;i<n;i++)

   ip_arr[i]=-1;//assigning -1 to every element.

  for(int i=0;i<n;i++)

  {

       cout<<ip_arr[i]<<" ";//printing every element.

  }

return 0;

}

output:-

100

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  

Explanation:

I am taking input of size.You should enter 100 for 100 values which have value -1.

5 0
3 years ago
Other questions:
  • Why do computers need to periodically check the dns for websites you have already visited? enter your answer here?
    15·1 answer
  • What is an independent data mart?
    8·1 answer
  • A hub transmits all incoming messages to all of its ports except the port where the messages came in. A switch usually sends mes
    14·2 answers
  • What is required to control access to the file system using file and folder permissions on a windows based computer?
    8·1 answer
  • What is the definition of D1-D4?
    14·1 answer
  • Apple's macOS and Microsoft Windows are examples of ________ software. utility application communication operating system
    13·1 answer
  • Disk ____ is the ability to spread data over multiple disks or volumes
    7·1 answer
  • PLEASE HELP ASAP<br> Which technology encrypts traffic between a web browser and a website?
    10·2 answers
  • 1. Give one reason why data is represented in binary in a computer [1]
    10·1 answer
  • HELP<br> When differentiating data, the WHAT of the data is:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!