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 coworker is taking a computer overseas and asks you what concerns he should have. What do you tell him
DerKrebs [107]

Answer:

The components within the computer can get damage during travel, so he could improve the box protection with foam thingies

Explanation:

3 0
2 years ago
Your company collects and stores security camera footage. Within the first 30 days, footage is processed regularly for threat de
Sliva [168]

Answer:

<em>For the very first 30 days, use Google Cloud Regional Storage, then switch to Coldline Storage.</em>

Explanation:

Coldline Storage is a cost-effective, extremely durable information archiving, online backup, and disaster recovery web host.

Your information is available in seconds, not hours or days, unlike many other "cold" storage providers.

5 0
4 years ago
What is that tool that makes liquid metal? It is used for wires, Ik I might sound dumb but I'm rlly curious​
Alex_Xolod [135]

Answer:

A blow torch?

Explanation:

4 0
3 years ago
A secret information for using email is ____________
babymother [125]

wekipedia \:

6 0
3 years ago
Read 2 more answers
mips Write a program that asks the user for an integer between 0 and 100 that represents a number of cents. Convert that number
Mumz [18]

Answer:

Explanation:

The following code is written in python and divides the amount of cents enterred in as an input into the correct amount of quarters, dimes, nickels and pennies. Finally, printing out all the values.

import math

#First we need to define the value of each coin

penny = 1

nickel = 5

dime = 10

quarter = 25

#Here we define the variables to hold the max number of each coin

quarters = 0

dimes = 0

nickels = 0

pennys = 0

cents = int(input("Please enter an amount of money you have in cents: "))

if cents > 0 and cents <= 100:

   if cents >= 25:

       quarters = cents / quarter

       cents = cents % quarter

   if cents >= 10:

       dimes = cents/dime

       cents = cents % dime

   if cents >= 5:

       nickels = cents /nickel

       cents = cents % nickel

   if cents > 0:

       pennys = cents / penny

       cents = 0

   print("The coins are: "

       "\nQuarters", math.floor(quarters),

       "\nDimes", math.floor(dimes), "\nNickels", math.floor(nickels), "\nPennies", math.floor(pennys))

else:

   print("wrong value")

8 0
3 years ago
Other questions:
  • Which of the following protocols is used to unsure secure transmissions on port 443?A. HTTPSB. TelnetC. SFTPD. SHTTP
    6·1 answer
  • An “evil twin” in the context of computer security is: a) A virus-laden attachment that looks just like a sincere attachment b)
    5·1 answer
  • Increasing your margins will increase the amount of space you have to type text on your document. Please select the best answer
    10·1 answer
  • EVERYONE PLS JOIN MY GOOGLE CLASSROOM<br> CODE: clmvjbd
    13·2 answers
  • my pc wants to run the highest graphics even though I restart it everyday and it gets around 10 fps and I have a 1080 Nvidia gra
    7·1 answer
  • Write a program that reads from a file called dictionary.txt which contains pairs of English and translated words separated by a
    12·1 answer
  • Which of the following is true for an API?
    6·1 answer
  • Which set of symbols encloses an if-then code block? Choose the best answer.
    10·1 answer
  • Write code that prints: Ready! numVal ... 2 1 Go! Your code should contain a for loop. Print a newline after each number and aft
    14·1 answer
  • An engineer has reported that a printer is no longer working and needs troubleshooting. You have been informed that there is a p
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!