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
Leya [2.2K]
2 years ago
12

Create a vector of structures experiments that stores information on subjects used in an experiment. Each struct has four fields

: ID, name, weights, and height. The field ID is an integer, name is a string, weights are a vector with two values in pounds (both of which are double values), and height is a struct with fields feet and inches (both of which are integers). The following is an example of what the format might look like.
Experiments
ID Name Weights Height (feet) Icnhes
1 2
1 1111 Bob 150.1 149.6 6 1
2 2222 Ann 106.2 106.6 5 3

Write a function printhheight that will receive a vector of structures in this format and will print the name, ID and height of each subject in inches (1 foot = 12 inches). This function calls another function height that receives a height struct and returns the total height in inches. This function could also be called separately.
Computers and Technology
1 answer:
ella [17]2 years ago
7 0

Answer:

im assuming this is required to be done in matlabs.

Explanation:

experiment.m

% Create an "experiments" vector of structures

% variable, and pass it to a function that will

% print the height of each subject

experiments(2) = struct('ID', 2222); 'name'; 'Ann'; ...  

   'weights'; '106.2, 106.6.9'; 'height'; struct('feet',5, 'inches',3);

experiments(1) = struct('ID',1111);'name'; 'Bob'; ...  

'weights'; '150.1, 149.6'; 'height'; ...

struct('feet', 6, 'inches', 1);

printhheight(experiments)

printhheight.m

function printhheight(experiments)

% Prints height of every subject

% Format of call: prinths(experiments vector)

% Does not return any values

for i = 1 : length(experiments), high = height(experiments(i)*height);

fprintf('%s is %d inches tall\n', ...

     experiments(i).name, high)

end

end

height.m

function ht = height(expstruct)

% Calculates height in inches of a subject

% Format of call: height(experiment struct)

% Returns height in inches

ht = expstruct.feet*12+expstruct.inches;

end

You might be interested in
When enter a function or formula in a cell, which is the character you must type?
vladimir1956 [14]
The answer is A. For instance, to use the sum function, you would need to =SUM()
7 0
3 years ago
Create the SQL statements for displaying the results for each of the following scenarios in the Academic Database. Save these st
Whitepunk [10]

Answer:

CREATE FUNCTION exam_eligible_students

   RETURN NUMBER AS

   num_students NUMBER(15);

BEGIN

   SELECT COUNT(STUDENT_ID)

   INTO num_students

   FROM STUDENT_ATTENDANCE

   WHERE ELIGIBILITY_FOR_EXAMS = 'Y';

   

   RETURN (num_students);

END;

Explanation:

exam_eligible_students is a made of name for the FUNCTION to be called.

num_students is a made up name for the RETURN to be called. The RETURN name is referenced in the INTO statement and as the name of the the return in the RETURN line in ().

4 0
3 years ago
What do work places allow a company to do
anygoal [31]
D. They provide a platform for collaboration
8 0
3 years ago
The choice of database does not have any impact on the relevancy of search results?
Nookie1986 [14]

Answer:

When searching for articles using library databases, the following tips should increase the relevance of your results. Quotation marks around two or more keywords - phrase searching - ensures that the results will include the exact phrase.

Explanation:

8 0
2 years ago
What is the output of the following code snippet if the variable named cost contains 100? if cost < 70 or cost > 150 : dis
DanielleElmas [232]

Answer:

The output is: Your cost is  100

Explanation:

Given

The above code snippet

and

cost = 100

Required

Determine the output of the code

if cost < 70 or cost > 150

The above condition checks if cost is less than 70 or cost is greater than 150

This condition is false because 100 is neither less than 70 nor is it greater than 150

So, the else statement will be executed.

discount = cost

Which means

discount = 100

So, the print instruction will print: Your cost is  100

6 0
3 years ago
Other questions:
  • You can use Facebook's live feed tool to broadcast content as you post it
    8·2 answers
  • 2. What is the purpose of an outline? (1 point)
    8·1 answer
  • How do you add text to a blank slide layout?
    5·2 answers
  • Write a short java method that takes an integer n and returns the sum of all the odd positive integers less than or equal to n.
    5·1 answer
  • Whats the difference between search engine and web browser?
    6·2 answers
  • Question 1 (1 point)
    10·2 answers
  • What command limits structural changes, such as adding, deleting, or moving sheets, that can be made in a workbook?
    13·1 answer
  • You coded the following class: public class N extends String, Integer { }When you compile, you get the following message:N.java:
    9·1 answer
  • Which of the following statements is false? a. InputStream and OutputStream are abstract classes for performing byte-based I/O.
    7·1 answer
  • Suppose you are choosing between four different desktop computers: one is Apple MacIntosh and the other three are PC-compatible
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!