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
hjlf
3 years ago
11

Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volu

me of a pyramid with a rectangular base. Relevant geometry equations:Volume = base area x height x 1/3Base area = base length x base width.(Watch out for integer division)import java.util.Scanner;public class CalcPyramidVolume {/* Your solution goes here */public static void main (String [] args) {System.out.println("Volume for 1.0, 1.0, 1.0 is: " + pyramidVolume(1.0, 1.0, 1.0));return;}}

Computers and Technology
2 answers:
soldi70 [24.7K]3 years ago
7 0

Answer:

public class CalcPyramidVolume {

public static void main(String[] args) {

 // Test the method pyramidVolume() by printing out a test case

               // result.

 System.out.println("Volume for 1.0, 1.0, 1.0 is: " + pyramidVolume(1.0, 1.0, 1.0));

 return;

}

// Method name is pyramidVolume()

// It receives three parameters of type double - baseLength,

// baseWidth, and  baseHeight;

// It returns the calculated volume (which is of type double) of the

// pyramid  using the appropriate formula.

public static double pyramidVolume(double baseLength, double baseWidth, double baseHeight) {

 // From the parameters given, calculate the base area of the

              // pyramid first.

 double baseArea = baseLength * baseWidth;

 // From the base area, calculate the volume of the pyramid.

 // Note the use of 1 / 3.0 rather than 1 / 3. This is to bypass the

 // integer  division of 1/3 which will give zero(0).

 double volume = baseArea * baseHeight * 1 / 3.0;

 // Return the calculated volume

 return volume;

}

}

Explanation:

There are two versions to this code. The first one allows the user to enter the values for the length, width and height of the pyramid. The second version uses preset values for the length, breadth and height of the pyramid. The second version is represented in the answer above.

The source code files for the two versions have been attached to this response. Kindly download the files and go through the codes especially the comments. Every segment of the codes contains explanatory comments. Carefully go through these comments for explanation of the codes.

Hope this helps!

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
Vinil7 [7]3 years ago
4 0

Answer:

static double pyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

  double Volume,baseArea;

  baseArea = baseLength * baseWidth;

  Volume = baseArea * pyramidHeight * 1/3;

  return Volume;

}

Explanation:

You might be interested in
Ivy is a student. She is looking for some freelance assignments during her vacation. Which of the following networking sites can
lara [203]

The answer is D. XING


3 0
3 years ago
how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
ra1l [238]

Answer:

The correct answer to the following question is:

To create fades you can click and then drag the end of the clip with a smart tool.

Fade Dialog Box is the fade curve.  

Explanation:

Smart Tool is an application which also provide their users with the features of the quick access menu by which they can easily access their programs or the software.

By using smart tool the user also creates a crossfade.

8 0
2 years ago
What does "ttyt" stand for?
EastWind [94]
TTYT stands for "talk to you tomorrow".
6 0
3 years ago
Read 2 more answers
When conducting research on the internet, what is a starting point for determining how to start the research?
Alex787 [66]
It depends on what you're researching for.
4 0
3 years ago
What are the different types database of end users? Discuss the main activi-ties of each
disa [49]

Answer:

following types of databases available in the market −

Centralised database.

Distributed database.

Personal database.

End-user database.

Commercial database.

NoSQL database.

Operational database.

Relational database.

Cloud database.

Object-oriented database.

Graph database

8 0
2 years ago
Read 2 more answers
Other questions:
  • _ effects determine how slide elements disappear
    11·1 answer
  • true or false? to change document properties, first tap or click file on the ribbon to open the properties view.
    6·2 answers
  • The length property of the String object returns
    15·1 answer
  • Encrypting text allows us to encrypt and decrypt the text using a special key.
    9·1 answer
  • X = 10<br> y = 20<br> x &gt; y<br> print("if statement")<br> print("else statement")
    6·1 answer
  • Data type can only be true or false <br><br> Answer: Bool
    15·1 answer
  • What is the interface of an app?
    11·1 answer
  • A video consists of a sequence of:
    8·1 answer
  • The function that overloads the ____ operator for a class must be declared as a member of the class.
    14·1 answer
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!