| hw5_problem1.m |
function [output] = hw5_problem1(names, numbers, threshold)
% getting the column numbers of the elements greater then threshod
% in numbers
[col] = find(numbers(:,4) > threshold);
output = [];
% looping for each column
for indx = 1:numel(col)
% assembling a new struct for each index position
new_struct.first = names(col(indx, 1), 1);
new_struct.middle = names(col(indx, 1), 2);
new_struct.last = names(col(indx, 1), 3);
new_struct.birth_month = numbers(col(indx, 1), 1);
new_struct.birth_day = numbers(col(indx, 1), 2);
new_struct.birth_year = numbers(col(indx, 1),3);
new_struct.hours_in_space = numbers(col(indx, 1),4);
% appending the struct as a vector to output
output = [output, new_struct];
end
end |
| hw5_problem1_driver.m ( Run this file, not the above one) |
clc
clear all
names = ["Malcolm" "Scott" "Carpenter";
"Leroy" "Gordon" "Cooper Jr.";
"John" "Herschel" "Gleen Jr.";
"Virgil" "Ivan" "Grissom";
"Walter" "Marty" "Schirra Jr."];
numbers = [5 1 1925 4;
3 6 1927 225;
7 18 1921 217;
4 3 1926 5;
3 12 1923 295];
output = hw5_problem1(names, numbers, 200)
output(1)
output(2)
output(3) |
OUTPUT


1. (10 pts) Write a function called hws_problem1 that accepts three input arguments: 1) a 3-column...
Write a C program that includes a function called moveEm() that accepts the ADDRESSES of three double variables as input. The function should move the value of the smallest variable into the first variable, the middle value into the middle variable, and the largest value into the third variable. Call your function from within your program using the arguments 7.8, 3.5, and 1.1 in order to demonstrate that it works (make sure your logic works for any order of largest,...
Problem 1: Write a function ProcessiClicker to take any sized table as an input with at least two string column variables LastName and Firstname, and removes any leading and trailing whitespace from variables in LastName and Firstname, and combines the resulting two columns variables into one column named StudentName, with only comma between the last name and the first names. For example, if one record entry in Lastname and Firstname contains " Jones " and " Adam", the final result...
Define an ordinary function called DisplayMin that has three parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMin must work when called with various types of actual arguments, for example string DisplayMin(string names[], int calories[], int size) or int DisplayMin(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with...
Define a function called DisplayMax that has 3 parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMax must work when called with various types of actual arguments, for example string DisplayMax(string names[], int calories[], int size) or int DisplayMax(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with the...
/***************************************************
Name:
Date:
Homework #7
Program name: HexUtilitySOLUTION
Program description: Accepts hexadecimal numbers as input.
Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE
Enter BYE (case insensitive) to exit the program.
****************************************************/
import java.util.Scanner;
public class HexUtilitySOLUTION {
public static void main(String[] args) {
// Maximum length of input string
final byte INPUT_LENGTH = 4;
String userInput = ""; // Initialize to null string
Scanner input = new Scanner(System.in);
// Process the inputs until BYE is entered
do {...
Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...
matlab
28 pts Question 8 Problem 4. Write the following function. Do NOT hard code using any of the examples. Your function should work for all possible inputs as specified by the problem. Hard coding will result in significant point loss. (B) (28 Points) Function Name: birthday Party Input (2): (char) An Mx 11 array formatted with information about various birthdays (char) An MxN array of names Output (l): (char) A string containing information about the best birthday Function Description:...
Use python!!! need to match the execution result that is provided. Part One – Keyword Arguments and Default Values Write an invoice function. The function will generate a simple invoice and will have two required arguments and two keyword arguments. The two required arguments are unitPrice and quantity. The first keyword argument is shipping, and it has a default value of 10. The second keyword argument is handling, and it has a default value of 5. Test it twice from...
Use python!!! need to match the execution result that is provided. Part One – Keyword Arguments and Default Values Write an invoice function. The function will generate a simple invoice and will have two required arguments and two keyword arguments. The two required arguments are unitPrice and quantity. The first keyword argument is shipping, and it has a default value of 10. The second keyword argument is handling, and it has a default value of 5. Test it twice from...
Question set 1 (Java) object oriented: 1.Write a class called Student. The class should be able to store information regarding the name, age, gpa, and phone number of a Student object. Please write all the setter and getter methods. Finally, write a Demo class to demonstrate the use of the class by creating two different objects. 2.Use the same Student class from the previous problem. This time,you will write a different Demo class, in which you will create three Student...