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
Please Help ASAP. Marking Brainliest For Correct Answer.
mezya [45]

Answer: It is not working because it is missing the code needed to turn right.

Sentence :The robot would move forward two squares and would stay stuck there because it can not move forward nor turn left. You would need to add code for the robot to be able to turn right so that the robot can reach the goal

6 0
2 years ago
In the context of applications of artificial intelligence (AI), _____ perform well at simple, repetitive tasks and can be used t
Elina [12.6K]

Answer:

The right response is "Robots ".

Explanation:

  • A robot seems to be an independent machine that can detect its surroundings, conduct simulations, as well as take action throughout the modern or actual environment.
  • It is indeed a piece of computer-controlled equipment, which would also be utilized autonomously for carrying out duties or other hazardous tasks.
7 0
3 years ago
Which activity is performed during high-level design in the V-model?
SVETLANKA909090 [29]

Answer:

understanding component interaction

4 0
2 years ago
Part B: Find the value of G: if A = 3, b=4, and C = 5.
antiseptic1488 [7]

Answer:

G=(A^3 + B) * 4-c^2

To calculate G if A=3, b=4 and C=5

cobegin

p1: A^3 = 27

P2:C^2 =25

P3: p1 +B =31

P4:P3*4 =124

P5:P4-P2 =99

coend

Explanation:

One operation is performed at a time, and on the basis of priority as we have only one processor.

6 0
3 years ago
A computer scientist from the 1960's who developed the mouse, computer networking, and used a small musical keyboard to control
PIT_PIT [208]
Steve Jobs im pretty sure
7 0
3 years ago
Other questions:
  • What type of devices are the key board and the mouse?
    10·1 answer
  • Dialogue is not a characteristic of functional text because...
    12·1 answer
  • Which javascript method should you use if you want to specify a message string to appear on your web page as it loads?
    13·1 answer
  • The PATH environment variable.
    5·1 answer
  • A ____ client locates all or most of the processing logic on the server.
    11·1 answer
  • what is it called when someone uses software to run multiple operating systems on one computer at the same time? A.functional vi
    9·1 answer
  • What is information associated with a document to help describe that document called?
    14·1 answer
  • Which of the following is true about overloaded methods?
    6·1 answer
  • If a company gave you a free version of their software and encouraged you to try and improve it and share it with the only commu
    8·1 answer
  • Fictional Corp has a data center that runs multiple internal applications. However, they want to migrate their email to a cloud
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!