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
There is no reason to study the works of famous photographers because they will make you less creative.
weeeeeb [17]
I think it is true because you may be ‘inspired’ by a famous artist but if you’re always being inspired by others its not 100% yours / you being creative
8 0
3 years ago
Read 2 more answers
Which of the following best describes a proxy firewall? A. It sends traffic through another host. B. It acts as a gateway for re
12345 [234]
The answer would be B, for your computer is considered a client instead of server.
6 0
3 years ago
computer has a 32-bit instruction word broken into fields as follows: opcode, six bits; two register file address fields, five b
lina2011 [118]

Answer:

a.  2^6, or 64 opcodes.

b.  2^5, or 32 registers.

c. 2^16, or 0 to 65536.

d.  -32768 to 32768.

Explanation:

a. Following that the opcode is 6 bits, it is generally known that the maximum number of opcodes should be 2^6, or 64 opcodes.

b. Now, since the size of the register field is 5 bits, we know that 2^5 registers can be accessed, or 32 registers.

c. Unsigned immediate operand applies to the plus/minus sign of the number. Since unsigned numbers are always positive, the range is from 0 to 2^16, or 0 to 65536.

d. Considering that the signed operands can be negative, they need a 16'th bit for the sign and 15 bits for the number. This means there are 2 * (2^15) numbers, or 2^16. However, the numbers range from -32768 to 32768.

6 0
3 years ago
Write F id the following is formatting tags, H for heading tags, S for structural tags, and SC if it belongs to a seperator/cont
Rina8888 [55]

Answer:

Here!

Hope this helps. Please mark brainliest!

6 0
2 years ago
Identify the operation which is NOT one of the parts of the fivebasic set operations in relational algebra?
wariber [46]

Answer:

Join

Explanation:

Five basic set operators in relational algebra are as follows:

  • Selection - tuple selection
  • Projection - extract columns
  • Cartesian product - cross product of relations
  • Set union - union of two relations
  • Set difference - minus operation on two relations

As we can see, Join is not part of the basic set operations but it is implemented using the Cartesian Product operator.

5 0
3 years ago
Other questions:
  • If you want to tune into a radio station that is carried by a signal with wavelength 3.0 meters, what channel would you choose?
    12·1 answer
  • What is the value of length after the code that follows is executed?int[][] nums = { new int [] {1, 2, 3},new int [] {3, 4, 5, 6
    8·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • Choose the word that best completes this sentence. ____________ should cover every part of the worksite.
    10·2 answers
  • When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the accoun
    10·1 answer
  • What do the groups in professional networking sites allow you to do?
    10·1 answer
  • Create a Divisible application that displays a random integer between 1 and 100 and displays appropriate messages stating whethe
    5·1 answer
  • What is a common indicator of a phishing attempt cyber awareness 2022
    9·1 answer
  • What is a disadvantage of communicating on social media?
    14·1 answer
  • What are benefits of AI
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!