Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete as soon as possible. Thank you! Design specifications Create a Java project project 8 and a package package 8 Call your class MyVector.
Please complete as soon as possible. Thank you! Design specifications
Create a Java project project and a package package
Call your class MyVector. Define a second class containing a main method that exercises the class
MyVector as an application. That is a main method that runs through a selection of arithmetic and
logical operations and uses MyVector output. The two classes should be saved in two different files.
Your class MyVector should keep the vector in an ArrayListLab Assignment #B
Objective: This assignment will help you review the ArrayList class as a typesafe generic data type.
Program assignment: Build an ADT for vectors.
Your program should have the following header:
A vector consists of real components dots, The operations between two vectors
: and dots, are defined as follows:
addition dots,
subtraction dots,
dotproduct dots
equivalence if and and dots and :
scalarproduct dots, where is a real number.
absolutevalue
You should have two constructors:
a One constructor, with parameters double initvalues where initvalues are
the initialization values for the new vector.
b The copy constructor.
You should have an accessor function for the th components of a vector.
You should have member functions for arithmetic: plus and minus which, for example, would
be used as: plus where and are MyVector objects.
You should have a member function for scaling: scaledBy which, for example, would be used as:
scaledBy where and are MyVector objects, and is a real number.
You should override the toString method for display on System. out
You should override the equals method.
You should create an absolute value function: abs
You should build a dot product function:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started