answer.
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
AlekseyPX
2 years ago
7

Define a function PyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the vo

lume of a pyramid with a rectangular base. Relevant geometry equations: Volume = base area x height x 1/3 Base area = base length x base width. (Watch out for integer division).

Computers and Technology
2 answers:
posledela2 years ago
8 0

Answer:

The Program to this question can be given as:

Program:

#include <iostream> //header file.

using namespace std;

double PyramidVolume(double baseLength, double baseWidth, double pyramidHeight)  //define a method PyramidVolume

{

   double baseArea,Volume; //declare variable.

   baseArea= baseLength * baseWidth;  //calculate baseArea

   Volume = ((baseArea * pyramidHeight) * 1/3);  //calculate Volume

   return Volume; //return Volume

}

int main() //define main method.

{

double x,baseLength,baseWidth,pyramidHeight; //define variable.

cout<<"Enter baseLength :"; //message.

cin>>baseLength; //input value.

cout<<"Enter baseWidth :";//message.

cin>>baseWidth;  //input value.

cout<<"Enter pyramidHeight :";//message.

cin>>pyramidHeight;  //input value.

x=PyramidVolume(baseLength,baseWidth,pyramidHeight); //calling

cout << "Volume of given value is :"<<x; //print value.

return 0;

}

Output:

Enter baseLength :1.0

Enter baseWidth :1.0

Enter pyramidHeight :1.0

Volume of given value is :0.333333

Explanation:

The description of the above program can be given as:

  • In the above c++ language program firstly we include the header file. Then we define a function that is " PyramidVolume". The return type of this function is double because it return value and in this function, we pass three-parameter that is baseLength, baseWidth, and pyramidHeight. The data type of this variable is double.
  • In this function, we define two variable that is "baseArea and Volume" that is used for holding the calculated value. The variable baseArea holds the area of the pyramid and the volume variable holds the volume of the pyramid.
  • Then we define a main function. In this function, we define four variables that is "x, baseLength, baseWidth, and pyramidHeight". The baseLength, baseWidth, and pyramidHeight variable are used to take input from the user and pass into the function. The variable x is used to hold the return value of the function and we print this variable.

zubka84 [21]2 years ago
3 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
Float_abs - return bit-level equivalent of absolute value of f for * floating point argument f. * both the argument and result a
olga_2 [115]

#include <stdio.h>

int main(void) {

            // your code goes here

            //unsigned a =float_times_four(0x80000000);

            unsigned float_times_four(unsigned uf){

                unsigned expn = (uf >> 23) & 0xFF;

                printf(expn);

                unsigned sign = uf & 0x80000000;

                unsigned frac = uf & 0x007FFFFF;

                if(expn == 255 ||(expn == 0 && frac ==0))

                    return uf;

                if(expn){

                    expn<<2;

                }else if(frac == 0x007FFFFF){

//here 0x7FFFFF given by you that is wrong you place this 0x007FFFFF will excute

                    frac>>2;

                    expn<<2;

                }else{

                    frac<<=2;

                }

return (sign) | (expn <<23) | (frac);

            }

            return 0;

}

3 0
1 year ago
Write an application that allows a user to enter the names and birthdates of up to 10 friends. Continue to prompt the user for n
baherus [9]

Answer:

<em>Written in Python</em>

names= []

birthday = []

name = input("Name: ")

bday = input("Birthday: ")

for i in range(1,11):

    names.append(name)

    birthday.append(bday)

    if name == "ZZZ":

         break;

    else:

         name = input("Name: ")

         bday = input("Birthday: ")

print("Length: ", end='')

print(len(names))

checknm = input("Check Name: ")

while checknm != "ZZZ":

    if checknm in names:

         ind = names.index(checknm)

         print(birthday[ind])

    else:

         print("Sorry, no entry for name")

    checknm = input("Check Name: ")

Explanation:

<em>The program is written in Python and I've added the full source code as an attachment where I used comments to explain difficult lines</em>

<em />

Download txt
7 0
1 year ago
JAVA
avanturin [10]

Answer:

   public ArrayList onlyBlue(String[] clothes){

       ArrayList<String> blueCloths = new ArrayList<>();

       for(int i =0; i<clothes.length; i++){

           if(clothes[i].equalsIgnoreCase("blue")){

               blueCloths.add(clothes[i]);

           }

       }

       return blueCloths;

   }

Explanation:

  • Create the method to accept an Array object of type String representing colors with a return type of an ArrayList
  • Within the method body, create and initialize an Arraylist
  • Use a for loop to iterate the Array of cloths.
  • Use an if statement within the for loop to check if item equals blue and add to the Arraylist.
  • Finally return the arrayList to the caller
3 0
1 year ago
Which of the following stakeholders makes policies for a green economy?
miskamm [114]

Answer:

government is the answer

7 0
2 years ago
Match each vocabulary word to its definition.
ycow [4]
<h2>Answer:</h2>

Following are the vocabulary words matched to their definitions:

1. Command:

Instructions that tell a computer  what to do.

Pressing a single button such enter key can also be said as command. So command is any instruction that tells a computer to perform specific action.

2. Desktop

The background screen on a computer.

When the computer is turned ON, the screen we see the first is the Desktop. It has several icons that lead to different folders and files.

3. GUI

Rectangular area on a computer screen where the action takes place performing more than one activity at a time.

GUI stands for Graphical User Interface. It is an interface that allows to create application that may run using icons and labels instead of text commands

4. Menu

List of commands.

A menu is a drop down list that allows us to choose a command from the present ones. Menus are used vastly. For example: Simply a right clicking on computer's screen we see a menu having commands for arranging of icons as well as refreshing.

5. Multitasking

Interface that enables users to easily interact with their computers.

Multitasking allows the users to perform more than one task at a time. Multitasking helps to save time.

6. Window

The main work area.

The opened pane o any program is termed as a window. work is done inside the window of the program.

<h2>I hope it will help you!</h2>
4 0
1 year ago
Read 2 more answers
Other questions:
  • When a switch configuration includes a user-defined error threshold on a per-port basis, to which switching method will the swit
    13·1 answer
  • Shirley was unsure about what career to go into. Her high school counselor suggested a personal assessment to point out Shirley’
    12·2 answers
  • Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of strings
    14·2 answers
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all
    7·1 answer
  • The Pentium 4 Prescott processor, released in 2004, had a clock rate of 3.6 GHz and voltage of 1.25 V. Assume that, on average,
    8·1 answer
  • Compare the elements of the basic Software Development Life Cycle with 2 other models. How are they similar? How are they differ
    9·1 answer
  • Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only
    9·2 answers
  • Write a static method named countLastDigits that accepts an array of integers as a parameter and examines its elements to determ
    8·1 answer
  • In the next five years there are expected to be over _____ unfilled jobs in the US in computer science.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!