A matrix named mach contains three columns of data concerning the energy output of several machines. The first column contains an ID code for a specific machine, the second column contains the total amount of energy produced by that machine in calories, and the third column contains the amount of time required by that machine to produce the energy listed in column 2 in hours. Write a function to accept as input the matrix mach and return a new matrix named P containing two columns and the same number of rows as mach . The first column should contain the machine ID codes, and the second column should contain the average power generated by each machine in units of watts. The function should utilize for loops to do this.

Question
A matrix named mach contains three columns of data concerning the energy output of several machines. The first column contains an ID code for a specific machine, the second column contains the total amount of energy produced by that machine in calories, and the third column contains the amount of time required by that machine to produce the energy listed in column 2 in hours.
Write a function to accept as input the matrix mach and return a new matrix named P containing two columns and the same number of rows as mach . The first column should contain the machine ID codes, and the second column should contain the average power generated by each machine in units of watts. The function should utilize for loops to do this.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Java

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Computer Science Question

A: Note: As per the guidelines Q1 with three sub-parts can be answered. Re-post the question for the so...

Q: 2. What are the differences between the top-down and bottom-up approaches to information security?Wh...

A: What are the differences between the top-down and bottom-up approaches to information security?Why i...

Q: a. Show that the disk moves made in the classic recursive algorithm for the Towers of Hanoi puzzle c...

A: a.Disk moves for Tower of Hanoi puzzle The disk moves that are made in the classic recursive algorit...

Q: How an executable infecting computer virus might append itself to an executable. What changes must i...

A: The VIRUS stands for vital information Resource under siege.The virus may be loaded into your comput...

Q: Create a complete ERD in Crow’s Foot notation that can be implemented in the relational model using ...

A: In the crow’s foot notation, entities are displayed in a box with the attributes listed below the na...

Q: Write a Java program that prompts the user to enter an integer and reports whether the integer is a ...

A: Create a class with name Check_pal, and initialize a global variable number of class methods.Create ...

Q: Download the attached CreateRandomNumbersFile.cpp file, open it in Dev C++, and then compile and run...

A: The given CreateRandomNumbersFile.cpp asks the user to enter last name and then creates a txt file c...

Q: write code in c++ to calculate f(0.006), wheref(x) = e−x − cos xln(x + 1)correctly to ten decimal pl...

A: Create a C++ program and include all required modules.Define a macro "e" with value 2.71828.Create a...

Q: a. Construct a Huffman code for the following data: Symbol A L I Z P Frequency 4.5 .5 3.0 1.0 1...

A: a)Constructing Hauffman code for the given data:

Q: 5. How many times will the following do loop execute and what is the output? i 1; do { i= 2*i; cout ...

A: Determining the number of times the loop executes:The loop will execute for 5 times. The “do..while”...

Q: To increase security of data stored on an RODC, what can be configured to specify domain objects tha...

A: Windows Server 2008 produces a new kind of domain controller, RODC (Read-only domain controller). Th...

Q: Write a program that will present the user with a main menu of options which the user can choose fro...

A: Program:import java.util.Scanner;public class Main {publicstaticvoid main(String[] args) {char user_...

Q: Please Use JAVA to solve the problem

A: Create a java class “ArrayInv” and create a main method inside it.And declare a required variable to...

Q: in c++ Create a new file (in Dev C++)  In Lab 2, you created a menu for a simple calculator program...

A: This C++ calculator program contains following functions:displayMessage : It prints string message o...

Q: Please explain how you solve the follwing problem:

A: Since you have posted multiple questions and have not specified which question needs to be solved, w...

Q: Why did  Cisco systems transition from a standalone access control system to an IP networked systems...

A: Standalone control systems:Basic access control systems.Used at a single location.Not networked with...

Q: Hi I am coding for java and I am trying to generate 20 numbers in the sequence of  1, 2, 4, 8, 16, 3...

A: In this java program,Print a 20 numbers series in the sequence of 1, 2, 4, 8, 16, 32, ...Print the 5...

Q: CAREER B VENT LYY a sqeo1 NON 0LO no o N aND Welcome | MYSAIL Oakland Un X Th Course: CSI-1420-43702...

A: This program is written in C language. Year is given as input and Easter Sunday's Month and day is c...

Q: Are the following two clauses the same: constraint X primary key (Y, Z) and constraint X primarykey ...

A: Primary key:Primary key is a key which is used to uniquely identify a row in a table.A Primary key c...

Q: Describe a cloud storage application and explain the advantages and disadvantages of such cloud stor...

A: Cloud storage:Cloud Storage is a service where data is remotely maintained, managed, and backed up. ...

Q: Write a program (or modify the one written for Lab 2) that displays the following menu and prompts t...

A: Create a main method and declare all required variables (two variables for operations (+, -, *, /) a...

Q: Create a program that prompts the user for an amount less than 100 and then displays the minimum num...

A: Program AlgorithmInitialize the required variables.Get the input from the user and check if the inpu...

Q: Odd man out: . Topological sort Algorithm DFS Algorithm Binary search Algorithm BFS Algorithm Prim's...

A: Answer:Binary Search AlgorithmExplanation:Topological sort Algorithm, DFS algorithm, BFS algorithm a...

Q: Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest r...

A: The following source code will perform the functions as specified in the question.

Q: I am getting stuck on the code to see if its a factor or not. Im not sure where I went wrong.

A: The following is the source code which prints whether a number is a factor of generated random numbe...

Q: Question 2: Which statement(s) is/are true about vectors? a) A vector's size is static. b) A vector'...

A: VectorsA vector is an object that has both magnitude and direction. It is a directed line segment wh...

Q: What are whole disk encryption (WDE) solutions and under what circumstances are they required?

A: DefinitionWhole Disk Encryption (WDE) solutions, basically plays the foremost role in the field of c...

Q: In python  Write a for loop (using the range() function) that will print the integers 10,15,20,25,30...

A: Program Instruction:Use range() function to start with 10 and end with 51 as range() function loops ...

Q: What are the differences between the top-down and bottom-up approaches to information security? Why ...

A: Top-down approach:Top-down approach is the division of system into subsystems which are done to gain...

Q: I need help programming this problem in C++   Given an array of N elements, what is the average numb...

A: Linear Search:Take the array of N number of elements. Best case:Assume, that the search element is a...

Q: 1. Write a program in Python named filemaker.py that will be used to store the first name and age of...

A: This python program asks user to enter First name and Age of a number of friends. This program name ...

Q: In C++ why is a binary search function almost always more efficient than a linear search function?

A: In C++, binary search function is more efficient than linear search function because:Array must be s...

Q: Please explain how you solve the follwing problem:

A: The context free grammar is given below. To convert it into Chomsky normal form, some rules must be ...

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Program Instructions:Declare the initial balance to $5000.Use do-while loop to repeatedly show the m...

Q: Use the Design Recipe to write a function called my_sum  that consumes one parameter, assumed to be ...

A: The python program obeys the following rubrics:Defining a function my_sum which accepts a parameter,...

Q: Hi, I have to display the first 20 Fibonacci numbers to the console. The first two numbers are given...

A: The following is the source code that will generate the first 20 Fibonacci numbers and prints the su...

Q: A bit confused on where to begin this program. I'm confused by the information I'm being given I thi...

A: In this program user wants to perform following tasks:    1.Taking inputs as a (A, B, C).     2. Cal...

Q: Create a new Python program (you choose the filename) that contains a main function and another func...

A: Programimport randomdef changelist(myList)middleLsit=myList[3:9]print"The size of the list is now ",...

Q: Please explain how you solve the follwing problem:

A: Hello. Since you have posted multiple questions and not specified which question needs to be solved,...

Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when...

A: Following is the program code that takes input from the user all positive integer and terminates if ...

Q: Python 3.7.4 Write the definition of a function twice, that receives an int parameter and returns an...

A: Program code:

Q: In Python use the Design Recipe to write a function,  count_odds, that consumes a list and two integ...

A: Program Instructions:Write the function header and type contrast of the program.Write description an...

Q: (Emirp) An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also a ...

A: The Java program is written to display first 100 emrip numbers which are nonpalindromic numbers whos...

Q: Design a reasonably efficient algorithm for solving each of the following problems and determine its...

A: AlgorithmLet x be one of the numbers and the other number is n-x. The first step is to maximize f(x)...

Q: Given the information below, create the fully labeled Crow's Foot ERD using a specialization hierarc...

A: The fully labelled Crow's Foot ERD using a specialization hierarchy is given below. The ERD contain ...

Q: Compare and contrast only two types of computer data storage approaches.

A: Comparing and contrasting two data storage approaches:

Q: Using C++ 11 Write a program which overloads fractions arithmetic operations for division. And inclu...

A: To write a program which overloads fractions arithmetic operation for division add the following mai...

Q: Select the FSMO role that is required to be online to facilitate the addition or removal of a domain...

A: Domain Controller:Domain controller is a server computer on Microsoft servers.The purpose of domain ...

Q: Question 1: What does the following code output? "Hello you, this is not a robot"; string str1 = str...

A:  Program explanation: The String variable “str1” is initialized to “Hello you, this is not a robot”....

Q: in python program4_4.pyWrite a program that prompts the user to enter a series of strings, but with ...

A: Program code: