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
Nonamiya [84]
3 years ago
11

k- Add the code to define a variable of type 'double', with the name 'cuboidVolume'. Calculate the volume of the cuboid and set

this variable value.

Computers and Technology
1 answer:
djverab [1.8K]3 years ago
7 0

Answer:

Here is the JAVA program to calculate volume of cuboid:

import java.util.Scanner; // Scanner class is used to take input from user

public class CuboidVol { // class to calculate volume of cuboid

public static void main(String[] args) { // start of main() function body

Scanner input= new Scanner(System.in); //create Scanner class object

// prompts user to enter length of cuboid

System.out.println("Enter the cuboid length:");

double length=input.nextDouble(); //reads the input length value from user

// prompts user to enter width of cuboid

System.out.println("Enter the cuboid width:");

double width=input.nextDouble(); //reads the input width from user

// prompts user to enter height of cuboid

System.out.println("Enter the cuboid height:");

double height=input.nextDouble(); //reads the input height from user

/* the following formula is to calculate volume of a cuboid by multiplying its length width and height and a double type variable cuboidVolume is defined to store the value of the resultant volume to it */

double  cuboidVolume= length*width*height; //calculates cuboid volume

//displays volume of cuboid and result is displayed up to 2 decimal places

System.out.printf("Volume of the cuboid (length " + length + "/ height " + height + "/ width" +width +" is: " + "%.2f",cuboidVolume);   } }

Explanation:

The formula for the volume of a cuboid is as following:

Volume = Length × Width ×  Height

So in order to calculate the volume of cuboid three variable are required for length, width and height and one more variable cuboidVolume to hold the resultant volume of the cuboid.

The program is well explained in the comments added to each statement of the program. The program prompts the user to enter the value of height width and length of cuboid and the nextDouble() method is used to take the double type input values of height length and width. Then the program declares a double type variable cuboidVolume to hold the result of the volume of cuboid. Then the last printf statement is used to display the volume of cuboid in the format format "Volume of the cuboid (length  / height  / width ) is" and the result is displayed up to 2 decimal places.

The screenshot of the program along with its output is attached.

You might be interested in
Which skill type refers to the knowledge and ability to perform a task?
Thepotemich [5.8K]

Sound, Audio for engineering sound Quality's.

7 0
3 years ago
Read 2 more answers
The machine that stores your data and files​
Oxana [17]

Answer:

Any file you create or download saves to the computer's secondary storage. There are two types of storage device used as secondary storage in computers: HDD and SSD.

thenks and mark me barinliestt :))

7 0
3 years ago
Need help please will mark brainliest
aleksklad [387]

Answer:

intranet

Explanation:

An intranet is a private network that you can't access outside the physical boundary of an organization

7 0
3 years ago
You work in an office that uses Linux and Windows servers. The network uses the IP protocol. You are sitting at a Windows workst
Aleksandr-060686 [28]

Answer:

PING

Explanation:

To check if there's still connectivity between the computer and server, I would use the ping command.

The ping command is primarily a TCP/IP command. What this command does is to troubleshoot shoot. It troubleshoots connection and reachability. This command also does the work of testing the name of the computer and also its IP address.

4 0
3 years ago
Explain how the use of the internet has allowed people to achieve some
zubka84 [21]

I don't know if this is going to help you or not because I'm only 13 but let me know if it helps people can now talk to one another more effectively because of things like zoom and it's become more efficient to work at home because we can have online meetings

5 0
3 years ago
Other questions:
  • Which best describes the difference between stocks and bonds ?
    8·2 answers
  • How do you create code on scratch?
    13·2 answers
  • What type of computer is likely to use so-dimms, have an internal power supply, and use a desktop processor socket?
    10·1 answer
  • The dfs replication engine uses a form of replication called
    6·1 answer
  • Which term is used to describe bitmap images
    8·2 answers
  • The Michael Porter Diamond of National Advantage is a framework that explains why countries foster successful multinational corp
    11·1 answer
  • Which term best describes a network connection that uses the Internet to give mobile users or branch offices secure access to a
    14·1 answer
  • Which of the following methods is a static method? The class in which the method is defined is given in parentheses following th
    5·1 answer
  • What is the best Genshin impact ship? My favorite is Xiao x Lumine. Put yours bellow.
    13·2 answers
  • What is mean by SEO?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!