Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi please edit the java code on the left.(do not change whats given) A MathVector object will be passed to your method. Return the 5th

image text in transcribedHi please edit the java code on the left.(do not change whats given)

A MathVector object will be passed to your method. Return the 5th element inside of that object. 2 1- limport java.util. Random; import java.util.StringJoiner; 3 4- public class preLabc { If you look in the file MathVector.java you'll see there is a way to extract the value of one element in the array contained inside a MathVector object: 5 public static int myMethod (Mathvector inputvector){ int valueAtsthposition = -182000; // default value for integer System.out.println("here is the contents object, inputvector: " + inputvector); // extract the value at the fifth position of the array in the object // Remember the count starts at a. So the 5th position has an index of 4. 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 * Returns the element at the specified index. * * @param index the index of the element to return * @return the element at the specified index */ public int at(int index) { return array[index]; } System.out.println("This is the value at position 5: " + valueAtsthPosition); // return the integer value found at position 5 of the array.. return valueAtsthposition; use it like myObject.at(4); to get the 4th element. You did similar operations (with a different syntax) with Matlab. } } What to reproduce this on your own machine? Here are some important files: * preLabC.java (fill this in) MathVector.java (the class with all the methods that the student should explore) MyTest.java (the JUnit testing file. Student can use this on their own computer if they wish)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago