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
The intended purpose of the following module is to determine whether the value parameter is within a specified range. The module
BARSIC [14]

The program does not consists of any syntax error but the module contains error in logic especially while placing the condition inside if statement.

Here we are actually planning to check whether the number passed in the “value” variable is within the given lower and upper range which is passed in second and third parameter.

Solution 1:

if value<=lower AND value>=upper Then

Display “The given number is outside the specified range.”

else

Display “The given number is within the specified range.”

End if

Alternate solution:

So for that the condition needs to be value>=lower and value <=lower. so  

if value > lower AND value <upper Then

Display “The given number is within the specified range.”

else  

Display “The given number is within the specified range.”

7 0
4 years ago
Need help asap please​
Fofino [41]
Because you can make it to where they cannot find or see or look or talk or anything on your profile it can cut off Comunication from the person. It can also protect your safety!
6 0
3 years ago
If your TV was showing a flat black or blue screen, or had "snow", what steps would you take to fix it?
faust18 [17]

Answer:

Assuming that TV was working fine and it stopped working when you restart or after power shutdown. Flat Black or blue screen or snow are all seems to be having HDMI cable sync issues. It can be fixed based on the model of the TV and connectivity it is using.

I would suggest to start with very basic step and should go step by step unless we narrow down the problem.

  1. Turn off all the components, unplug the cables and plug them back by leaving HDMI cables intact. So this process will reset all the units and may help in renegotiation.
  2. Plug all the cables and Turn on the TV.  Plug all other components like sound receiver and source device and Turn on the power.  This may solve the problem.
  3. If issue still persist. Unplug and Plug back HDMI cables and surrounding components in HDMI path. It may solve the issue.
  4. If the issue still persists, then change the HDMI cable itself and try rebooting all components.
  5. If input is changed then it might have caused the issue. So identify the cable from the receiver to the TV.  figure out its input and change the TV input to that value and it will work.
  6. In some TV's if power reset happens, It may revert to TV mode then change the video input based on your TV model.
  7. If the receiver is connected to TV via Coax then change the channel as per TV guide.
  8. If the receiver and its component is using AV or HDMI then use TV remote to change the input source until correct feed is found.
  9. If issue still persist, check the cable with another TV and see if it works. If its not then cable is at fault.
  10. If the cable is fine then change the TV and try above steps.If it works then TV is at fault.

Explanation:

8 0
4 years ago
The activity, set of institutions, and processes for creating, capturing, communicating, delivering, and exchanging offerings th
SOVA2 [1]

Answer: Marketing

Explanation: Marketing is the technique which works between the customer and the product producing companies.It is the mechanism in which the products are the produced or created and then sold to the customers with some attractive offers.

Different marketing strategy is made for attracting the audience towards the product purchase by the customer.It involves lot of exciting and attractive offers and schemes to be introduced,large advertising ,promotions etc.

5 0
3 years ago
What is a Layer 2 device that receives an electrical signal in one port, interprets the bits, and makes a filtering or forwardin
iren2701 [21]

Answer:

Router

Explanation:

Router -

It is a networking device which helps to forward the data packets between the networks of the computer .

It acts as a traffic director in the internet .

The data which is sent via internet is made into data packets . And then the packet is forwarded from one router to another , until the packed reaches its destination .

The function given in the question is about router .

5 0
4 years ago
Other questions:
  • "​the three legs of a project triangle are _____, scope, and time."
    8·1 answer
  • Consider the following network: proxy-cache On average there are 35 objects downloaded per second, and the average object size i
    14·1 answer
  • Which of the following statements about the placement of illustrations in documents is true?
    12·1 answer
  • What is the process of designing green buildings called
    9·2 answers
  • Helpppppppp!!!!!!!! Some program menus are the same in every program you open. Under the File menu, all of the following are the
    15·2 answers
  • Write a method that computes the average of the values in an array of doubles. The header of the method is as follows:
    14·1 answer
  • Question #4
    9·1 answer
  • Which system is understood by the computer system​
    7·1 answer
  • SOMEONE HELP 60 POINTS!!!!! When creating business publications, these two factors must be determined before planning the layout
    8·2 answers
  • The Synonyms submenu offers a list of synonyms for a word. Is it always a good idea to use whatever synonyms are presented on th
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!