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
QveST [7]
2 years ago
13

Using a function file, create a function that will compute the area and perimeter of a square given the length of the side. The

input variable will be the length and the output will be the area and the perimeter. Use an input command in the script file to ask the user to enter the length in inches, then use the function to compute the values and in the script file print the values to the screen. Repeat this until the user decides to quit For testing purposes please use the following inputs for the file you submit: Testing Conditions Length 5 in Length 10 in Length 7.5 in
Engineering
1 answer:
mylen [45]2 years ago
6 0

Answer:

Using Matlab, the code is here

function p = Sq(side)

a = side*side;

p = 4*side;

fprintf("The area of square is %.2f\n",a);

fprintf("The perimeter of square is %.2f\n",p);

end

while true

side = input("Enter the side of square: ");

Sq(side);

c = input("Do you wish to continue (Y/N) ?", 's');

if c=='n' || c=='N'

break;

end

You might be interested in
g The function below takes a single string parameter: sentence. Complete the function to return everything but the middle 10 cha
ale4655 [162]

Answer:

  1. def processString(sentence):
  2.    middle = len(sentence) // 2
  3.    output = sentence[0: middle - 5] + sentence[middle+5:]
  4.    return output
  5. print(processString("I have a dream"))

Explanation:

Create a function processString that take sentence as input paratemer (Line 1).

Next create a variable middle to hold the value of middle index of sentence string (Line 2)

Build the output string by slicing the input sentence from first character to character middle - 5th and from middle + 5th till the end of the string (Line 3).

Test the function using a sample sentence and we shall get the output "I am"

4 0
2 years ago
Outline an algorithm in **pseudo code** for checking whether an array H[1..n] is a heap and determine its time efficiency.
svlad2 [7]

Answer:

Condition to break: H[j] \geq max {H[2j] , H[2j+1]}

Efficiency: O(n).

Explanation:

Previous concepts

Heap algorithm is used to create all the possible permutations with K possible objects. Was created by B. R Heap in 1963.

Parental dominance condition represent a condition that is satisfied when the parent element is greater than his children.

Solution to the problem

We assume that we have an array H of size n for the algorithm.

It's important on this case analyze the parental dominance condition in order to the algorithm can work and construc a heap.

For this case we can set a counter j =1,2,... [n/2] (We just check until n/2 since in order to create a heap we need to satisfy minimum n/2 possible comparisionsand we need to check this:Break condition: [tex]H[j] \geq max {H[2j] , H[2j+1]}

And we just need to check on the array the last condition and if is not satisfied for any value of the counter j we need to stop the algorithm and the array would not a heap. Otherwise if we satisfy the condition for each j =1,2,.....,[n/2]p then we will have a heap.

On this case this algorithm needs to compare 2*(n/2) times the values and the efficiency is given by O(n).

3 0
2 years ago
The electrical energy used by an air conditioner for 2 minutes is 180 kJ. Calculate the power of this air conditioner in the fol
ELEN [110]

Answer:

I hope it is correct.....

5 0
2 years ago
Discuss the nature of materials causing turbidity in
Anestetic [448]

Answer:

a

Explanation:

5 0
2 years ago
Read 2 more answers
Derive an equation for the work of a mechanically reversible, isothermal compression of 1 mol of a gas from an initial pressure
Lyrx [107]

Answer:

The long derivation for work of a mechanically reversible, isothermal compression was done with detailed steps as shown in the attachment.

Explanation:

what is applied here is a long derivation from Work done in an isobaric process, the expression for the compressibility factor (Z) and the equation of state that was given. The requisite knowledge of Differentiation and Integration was used.

The detailed derivation from firs principle is as shown in the attachment.

5 0
2 years ago
Other questions:
  • 1. Which type of sketch most accurately represents what the finished product will look like?
    11·1 answer
  • Universal Containers (UC) has a requirement to expose a web service to their business partners. The web service will be used to
    10·1 answer
  • You are an electrician on the job. The electrical blueprint shows that eight 500-W lamps are to be installed on the same circuit
    11·1 answer
  • A flexural member is fabricated from two flange plates 7-1/2 x ½ and a web plate 17 x 3/8. The yield stress of steel is 50 ksi.
    8·1 answer
  • 15. A cold-chamber die-casting machine operates automatically, supported by two industrial robots.The machine produces two zinc
    9·2 answers
  • A desktop computer is to be cooled by a fan whose flow rate is 0.34 m3/min. Determine the mass flow rate of air through the fan
    12·1 answer
  • Two airstreams are mixed steadily and adiabatically. The first stream enters at 35°C and 30 percent relative humidity at a rate
    6·1 answer
  • Benzene vapor at 480°C is cooled and converted to a liquid at 25°C in a continuous condenser. The condensate is drained into 1.7
    15·1 answer
  • NEEDS TO BE IN PYTHON:ISBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13 . The la
    15·1 answer
  • What are some goals of NYFEA? Select three options.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!