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
Hunter-Best [27]
3 years ago
11

Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's

numbers on one line, each number followed by one space. (2 pts)
Ex:Enter weight 1:236.0Enter weight 2:89.5Enter weight 3:142.0Enter weight 4:166.3Enter weight 5:93.0You entered: 236.000000 89.500000 142.000000 166.300000 93.000000
Engineering
1 answer:
atroni [7]3 years ago
6 0

Answer:

See below in the explanation section the Matlab script to solve the problem.

Explanation:

prompt='enter the first weight w1:  ';

w1=input(prompt);

wd1=double(w1);

prompt='enter the second weight w2:  ';

w2=input(prompt);

wd2=double(w2);

prompt='enter the third weight w3:  ';

w3=input(prompt);

wd3=double(w3);

prompt='enter the fourth weight w4:  ';

w4=input(prompt);

wd4=double(w4);

prompt='enter the first weight w5:  ';

w5=input(prompt);

wd5=double(w5);

x=[wd1 wd2 wd3 wd4 wd5]

format short

You might be interested in
Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger
vredina [299]

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. void printLarger(int a, int b){
  4.    
  5.    if(a > b){
  6.        cout<<a;
  7.    }else{
  8.        cout<<b;
  9.    }
  10. }
  11. int main()
  12. {
  13.    printLarger(4, 5);
  14.    return 0;
  15. }

Explanation:

The solution code is written in C++.

Firstly define a function printLarger that has two parameters, a and b with both of them are integer type (Line 5). In the function, create an if condition to check if a bigger than b, print a to terminal (Line 7-8). Otherwise print b (Line 9-10).

In the main program, test the function by passing 4 and 5 as arguments (Line 16) and we shall get 5 printed.  

7 0
4 years ago
Implement
kolbaska11 [484]

Answer:

#include <iostream>

using namespace std;

// Pixel structure

struct Pixel

{

unsigned int red;

unsigned int green;

unsigned int blue;

Pixel() {

red = 0;

green = 0;

blue = 0;

}

};

// function prototype

int energy(Pixel** image, int x, int y, int width, int height);

// main function

int main() {

// create array of pixel 3 by 4

Pixel** image = new Pixel*[3];

for (int i = 0; i < 3; i++) {

image[i] = new Pixel[4];

}

// initialize array

image[0][0].red = 255;

image[0][0].green = 101;

image[0][0].blue = 51;

image[1][0].red = 255;

image[1][0].green = 101;

image[1][0].blue = 153;

image[2][0].red = 255;

image[2][0].green = 101;

image[2][0].blue = 255;

image[0][1].red = 255;

image[0][1].green = 153;

image[0][1].blue = 51;

image[1][1].red = 255;

image[1][1].green = 153;

image[1][1].blue = 153;

image[2][1].red = 255;

image[2][1].green = 153;

image[2][1].blue = 255;

image[0][2].red = 255;

image[0][2].green = 203;

image[0][2].blue = 51;

image[1][2].red = 255;

image[1][2].green = 204;

image[1][2].blue = 153;

image[2][2].red = 255;

image[2][2].green = 205;

image[2][2].blue = 255;

image[0][3].red = 255;

image[0][3].green = 255;

image[0][3].blue = 51;

image[1][3].red = 255;

image[1][3].green = 255;

image[1][3].blue = 153;

image[2][3].red = 255;

image[2][3].green = 255;

image[2][3].blue = 255;

// create 3by4 array to store energy of each pixel

int energies[3][4];

// calculate energy for each pixel

for (int i = 0; i < 3; i++) {

for (int j = 0; j < 4; j++) {

energies[i][j] = energy(image, i, j, 3, 4);

}

}

// print energies of each pixel

for (int i = 0; i < 4; i++) {

for (int j = 0; j < 3; j++) {

// print by column

cout << energies[j][i] << " ";

}

cout << endl;

}

}

// function prototype

int energy(Pixel** image, int x, int y, int width, int height) {

// get adjacent pixels

Pixel left, right, up, down;

if (x > 0) {

left = image[x - 1][y];

if (x < width - 1) {

right = image[x + 1][y];

}

else {

right = image[0][y];

}

}

else {

left = image[width - 1][y];

if (x < width - 1) {

right = image[x + 1][y];

}

else {

right = image[0][y];

}

}

if (y > 0) {

up = image[x][y - 1];

if (y < height - 1) {

down = image[x][y + 1];

}

else {

down = image[x][0];

}

}

else {

up = image[x][height - 1];

if (y < height - 1) {

down = image[x][y + 1];

}

else {

down = image[x][0];

}

}

// calculate x-gradient and y-gradient

Pixel x_gradient;

Pixel y_gradient;

x_gradient.blue = right.blue - left.blue;

x_gradient.green = right.green - left.green;

x_gradient.red = right.red - left.red;

y_gradient.blue = down.blue - up.blue;

y_gradient.green = down.green - up.green;

y_gradient.red = down.red - up.red;

int x_value = x_gradient.blue * x_gradient.blue + x_gradient.green * x_gradient.green + x_gradient.red * x_gradient.red;

int y_value = y_gradient.blue * y_gradient.blue + y_gradient.green * y_gradient.green + y_gradient.red * y_gradient.red;

// return energy of pixel

return x_value + y_value;

}

Explanation:

Please see attachment for ouput

6 0
3 years ago
Air enters a compressor operating at steady state at 1.05 bar, 300 K, with a volumetric flow rate of "84" m3/min and exits at 12
Nina [5.8K]

Answer:

W = - 184.8 kW

Explanation:

Given data:

P_1 = 1.05 bar

T_1 = 300K

\dot V_1 = 84 m^3/min

P_2 = 12 bar

T_2 = 400 K

We know that work is done as

W = - [ Q + \dor m[h_2 - h_1]]

forP_1 = 1.05 bar,  T_1 = 300K

density of air is 1.22 kg/m^3 and h_1 = 300 kJ/kg

for P_2 = 12 bar, T_2 = 400 K

h_2 = 400 kj/kg

\dot m = \rho \times \dor v_1 = 1.22 \frac{84}{60} =1.708 kg/s

W = -[14 + 1.708[400-300]]

W = - 184.8 kW

8 0
3 years ago
An AC circuit has a resistor, capacitor and inductor in series with a 120 V, 60 Hz voltage source. The resistance of the resisto
aliina [53]

Answer:

(i) 3.5385 ohm, 3.768 ohm (ii) 39.89 A (III) 4773.857 W (vi) 348 var (vii) 0.9973 (viii) 4.1796°

Explanation:

We have given voltage V =120 volt

Frequency f=60 Hz

Resistance R =3 ohm

Inductance L =0.01 H

Capacitance C =0.00075 farad

(i) reactance of of inductor X_L=\omega L=2\pi fL=2\times 3.14\times 60\times 0.01=3.768ohm

X_C=\frac{1}{\omega C}=\frac{1}{2\times 3.14\times 60\times 0.00075}=3.5385ohm

(ii) Total impedance Z=\sqrt{R^2+(X_L-X_C)^2}=\sqrt{3^2+(3.768-3.5385)^2}=3.008ohm

Current i=\frac{V}{Z}=\frac{120}{3.008}=39.89A

(viii) power factor cos\Phi =\frac{R}{Z}=\frac{3}{3.008}=0.9973

(VII) cos\Phi =0.9973

\Phi =4.1796^{\circ}

So power factor angle is 4.1796°

(iii) Apparent power P=VICOS\Phi =120\times 39.89\times 0.9973=4773.875W

(vi) Reactive power Q=VISIN\Phi =120\times 39.89\times SIN4.17^{\circ}=348var

5 0
3 years ago
In a vapor-compression refrigeration cycle, ammonia exits the evaporator as saturated vapor at -10°C. The refrigerant enters the
sergij07 [2.7K]

Answer:  (a) 0,142 (b) 52.99 (c) 2.83 (d) 88.26

Explanation:

If the refrigarating capacity is 150kw

(a) the mass flow rate of refrigerant, in kilograms per second  is 0.142

(b) the power input to the compressor, in kilowatts is 52.99

(c) the coefficient of performance is 2.83

(d) the isentropic compressor efficiency is 68.6 per cent

8 0
3 years ago
Other questions:
  • The current entering the positive terminal of a device is i(t)= 6e^-2t mA and the voltage across the device is v(t)= 10di/dtV.
    6·1 answer
  • Compare the use of a low-strength, ductile material (1018 CD) in which the stress-concentration factor can be ignored to a high-
    15·1 answer
  • Air at 80 °F is to flow through a 72 ft diameter pipe at an average velocity of 34 ft/s . What diameter pipe should be used to
    10·2 answers
  • A pump is used to circulate hot water in a home heating system. Water enters the well-insulated pump operating at steady state a
    14·1 answer
  • Please help <br>.. <br>....<br> . .<br>....<br>...​
    13·1 answer
  • Consider uniaxial extension of a test specimen. It has gauge length L = 22 cm (the distance between where it is clamped in the t
    6·1 answer
  • Calculate the line parameters ????′, ????′, ????′, and ????′ for a coaxial line with an inner conductor diameter of 0.5 cm and a
    13·1 answer
  • For a ceramic compound, what are the two characteristics of the component ions that determine the crystal structure?
    13·1 answer
  • A train consists of a 50 Mg engine and three cars, each having a mass of 30 Mg . If it takes 75 s for the train to increase its
    8·1 answer
  • Free poînts lol Philippînes - cool<br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!