Ask Computer Engineering Expert

prepare a program that will: 
• Display a program description to the user before asking for any input 
• Read the base length and height of a right pyramid as input from the user 
• Display all of the inputs back to the user, formatted to 2 decimal place as shown in the sample. The decimals of the two values should line up. 
• find out the volume of the right pyramid using the above formula 

o Notice that the square of the base is used in all three formulas. Compute and store this value separately. Then use the stored value in all the formulas. 
• find out the slant height of the right pyramid using the above formula 
• find out the surface area of the right pyramid using the above formula 
o Use the pre-defined sqrt function from the cmath library in both the slant height and surface area calculations. 
• prepare and call a separate, user-defined function to output the calculation results: 
o The function should have thee input parameters: surface area, slant height, and volume 
o From within the user-defined function, display surface area, slant height, and volume of the right pyramid formatted as shown below, each rounded to 2 decimal places. The decimals of the three values should line up, and also line up with the input values displayed from main. 
o No calculations should be performed from within this function. 

Sample Input and Output 

Documentation 

1) Be sure to include top of program comments as specified in course Content section 1.8: 

Your name, the course, and the assignment number 
What the Program Does including: 
What is Input 
Processing Performed 
What is Output 

Right Pyramid Calculations 

Enter pyramid base length (in inches): 1.111 
Enter pyramid height (in inches): 1.111 

RESULTS: 
For a Right Pyramid with 
Base Length of 1.11 inches 
Height of 1.11 inches 

Pyramid Slant Height is 1.24 inches 
Pyramid Surface Area is 3.99 square inches 
Pyramid Volume is 0.46 cubic inches 

Press any key to continue . . . 
2) You must also include a comment above each user-defined function that includes: 
What the function does 
The name and a description of any parameters that are input to the function 

3) For readability, make sure you have: 
- a SPACE before and after each operator (+, -, *, /, =) 
- a SPACE after each comma in your code 
- blank lines between sections of your code 

4) Remember that dividing one integer by another integer will produce an integer result. 
ex: 1 / 3 = 0 
So if you want floating point results, be sure that one of the operands is a floating point value. 
ex: 1 / 3.0 = 0.3333... 

5) Comment any constants/variables whose names are not completely descriptive. 


Submission 

This programming assignment is due by midnight Sunday. Submit your program source code 
(both of the .cpp files) to the Prog Assn 2 dropbox (located under the Dropbox tab in the online 
course). Both files should be attached to one submission for programming assignment 2. 

Before submitting your program files, you MUST name them as follows: 
Lastname-wk2-prog1.cpp 
Lastname-wk2-prog2.cpp 

For ex: 
Smith-wk2-prog1.cpp 
Smith-wk2-prog2.cpp

prepare a program that: 
• Defines the vacuum permeability value as a program constant using scientific notation. 
• Uses a separate, user-defined function to output a program description header to the user 
before prompting for input. This header should contain your name. For ex:
• Reads the number of turns in each coil, as input from the user 
• Reads the radius of the coil loops (in meters), as input from the user 
• Reads the current in the coils (in amperes), as input from the user 
• find outs the magnetic field 
o Use the pre-defined pow function from the cmath library to find out the 
fractional value raised to a power, used in the calculations. 
• Displays one or two blank lines after reading all the inputs, before displaying the results 
• Displays all data using the format given in the following sample output, which meet the 
following specifications: 
The number of turns in the coils should be displayed first. 
The coil radius and current should be displayed in fixed format, carried out to 3 
decimal places. Their decimals should line up. 
The vacuum permeability constant and find outd magnetic field should be 
displayed in scientific format, carried out to 5 decimal places. Their decimals 
should line up. 
All unit values should line up. 
NOTE: You are not required to validate any of the user input. You may assume that the user will 
enter a valid answer for each problem. 

Additionally, the program must: 
• Compile without errors, 
• Include appropriate mnemonic constant and variable declarations, 
• Prompt the user for data in a meaningful way, 
• Pause the program after the data is displayed, and 
• Adhere to the documentation standards for this course (see course Content section 1.8) 

Magnetic Field within Helmholtz coils 
by 
Mr. Joe Electric 
Sample Input and Output: 
The data in this ex find outs the magnetic field in the center of a Helmh

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M986138

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As