Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Mechanical Work Mechanical work is a basic physic equation that is calculated by taking the dot product of force vector by the displacement vector.

1 Mechanical Work

Mechanical work is a basic physic equation that is calculated by taking the dot product of force vector by the displacement vector.

You will be writing a program that takes in the amount of dimensions we are working in (the size of the vectors), followed by how many forces are being applied to it. It will then take in the final displacement vector and calculate the amount of work that was done:

For example:

Enter dimensions 3 Enter amount of force vectors 2 Enter the force vectors 1.0 1.0 1.0 1.0 1.0 1.0 Enter displacement vector 2.0 2.0 2.0 The mechanical work that was done 12.0 

In order to do this you will need to complete the implementation of the Vector class located in Vector.java.

//Vector.java

public class Vector { private int M; private double[] data; // M size Array

// create a M size vector of 0's public Vector(int M) { //Fill in code here }

// create matrix based on 2d array public Vector(double[] d) { //Fill in code here }

// copy constructor private Vector(Vector A) { this(A.data); }

// create and return the transpose of the invoking matrix

// return C = A + B // Example <1.0, 2.0> + <3.0 , 4.0> = <4.0, 6.0> //If the sizes do not match throw a run time exception public Vector plus(Vector B) { //Fill in code here }

// return C = A - B //If the sizes do not match throw a run time exception public Vector minus(Vector B) { //Fill in code here }

// does A = B exactly? public boolean eq(Vector B) { //Fill in code here }

// return C = A * B //Example <1.0, 2.0, 3.0> * <4.0, 5.0, 6.0> = 32.0 //If the sizes do not match throw a run time exception public double dotProduct(Vector B) { //Fill in code here }

//Generate a string for the vector for example "<1.0, 3.0, 4.0>" public String toString() { //Fill in code here } // print Vector to standard output using toString(). public void show() { //Fill in code here }

}

//MechanicalWork.java

//Use this class to calculate the mechanical work done.

public class MechanicalWork { public static void main(String[] args) { //Take in a number that tells how many dimensions the force is being applied in. //Take in a number that tells how many different forces are being applied. //Read in enough doubles for all of the force vectors. //Create a single force vector by totaling up all of the force vectors given. //Take in a distance vector in the same amount of dimensions. //Calculate the mechanical work done by taking the dot product of the distance vector with //the total force vector. } }

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

Step: 3

blur-text-image

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago