I got a bad grade for this lab, and I was wondering what would be the right way to do this while keeoing in mind that we cannot use arrays. If anyone knows, please help me as my professor is not responding to my inquiries at this time.
Function Lab
Sample output:
How many boxes do you want to measure? 3
Box 1:
Enter height, width, and depth: 3 4 5
Volume for box 1 is: 60
Box 2:
Enter height, width, and depth: 1.5 2.4 3.6
Volume for box 2 is: 12.96
Box 3:
Enter height, width, and depth: 2 2 2
Volume for box 3 is: 8
Goodbye
Instructions:
1. Prototype a double function named GetBoxVolume.
2. Prototype a void function named GetBoxSides.
3. In the main function:
a. Ask how many boxes to measure.
b. Write a loop to measure that many boxes.
c. Inside the loop:
i. Identify the box number, e.g. Box n: (see sample output)
ii. Call GetBoxSides.
iii. Display: “Volume for box n is “ (see sample output)
iv. Call GetBoxVolume.
v. Display the volume.
d. Display: “Goodbye” before exiting the main function.
Below the main function:
4. Define GetBoxVolume that returns height times width time depth.
5. Define GetBoxSides that prompts the user for and gets the height, width, and depth.
While the function return types are included in the prototype instructions, you must determine the parameters.
Declare whatever variables you need.
Save your source code as functions.txt and submit to Canvas.
Be sure to include your name at the top as comments and sample output at the bottom as comments.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Design the logic (flowchart and/or pseudocode) using arrays for a program. It asks a user to enter a product number, then searches through an existing list of product numbers, for each one of which a recall has been issued recently. Based on the search result, a message will be displayed to the user (e.g., "A recall has been issued for this product." or "No recall found for this product."). Here is the existing list of product numbers: 100, 103, 108, 110, and 125. PreviousNextarrow_forwardPrompt: In Python language, write a function that applies the logistic sigmoid function to all elements of a NumPy array. Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def sigmoid(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-100, 100, 0.5) outputs = sigmoid(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs,'Black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()arrow_forwardMATLABarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education