Computers and Technology

Using the Vector1D interface, implement an immutable class called PrecisionVector1D that uses an array of doubles internally while exposing elements as integers. This interface is used to represent a vector of numbers: (1, 2, 11), (23, 23, 52, 31), (), etc. It is designed to store decimals until needed. For example, the first vector from the last sentence could be multiplied by 1.1 to yield an internal representation of (1.1, 2.2, 12.1) which would be displayed as (1, 2, 12). When converting from double to int, you may use your choice of rounding schemes (up or down; casting). Do not use the builtin Java functionality for cloning or duplicating arrays. public interface Vector1D {
//returns the i'th element of the vector. assume the index is valid.
public int getElement(int i);
//returns the number of elements in the vector
public int getLength();
//returns the vector as a string of integers (e. g., "(1, 3, 4)")
public String getString();
//returns the sum of all elements of the vector.
public double getSum();

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jumpgirll
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
image
Computers and Technology, 23.06.2019 19:30, wilkinsonei4069
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a, b] se pot scrie ca produs de două numere prime? “.
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, chloeholt123
For which utilities, if any, does the landlord pay?
Answers: 2
Do you know the correct answer?
Using the Vector1D interface, implement an immutable class called PrecisionVector1D that uses an arr...

Questions in other subjects: