Homework 00

Vector Math Program

Due 02/02/2024 by 11:55PM

 

Objective: 

Write a program that performs a variety of vector math operations. These operations include adding vectors, subtracting vectors, and finding the magnitude of a vector.

 

Requirements:

 

Additional Notes:

 

 

 

Example Dialog:
*The following Example Dialog demonstrates the interactions between a user and ONE possible implementation of the required software’s front-end / user interface. The software’s front-end / user interface may be implemented in MANY different ways and will receive full credit as long as it meets the most minimal of the above requirements. While you may use the example dialog as a guide, it is strongly encouraged to create the front-end / user interface in your own way. *

Key

Unhighlighted Text

Program’s Output

Highlighted Text

User’s Input

 

 

Welcome to the Vector Operations Program!

Enter 1. To Add 2 Vectors

Enter 2. To Subtract 2 Vectors

Enter 3. To Find the Magnitude of a Vector

Enter 9. To Quit

1

Enter the size of the Vectors

3

Enter values for Vector1

1.0

2.0

3.0

Enter values for Vector2

4.0

5.0

6.0

Result:

1.0

2.0

3.0

+

4.0

5.0

6.0

=

5.0

7.0

9.0

Enter 1. To Add 2 Vectors

Enter 2. To Subtract 2 Vectors

Enter 3. To Find the Magnitude of a Vector

Enter 9. To Quit

2

Enter the size of the Vectors

3

Enter values for Vector1

1.0

2.0

3.0

Enter values for Vector2

4.0

5.0

6.0

Result:

1.0

2.0

3.0

-

4.0

5.0

6.0

=

-3.0

-3.0

-3.0.

Enter 1. To Add 2 Vectors

Enter 2. To Subtract 2 Vectors

Enter 3. To Find the Magnitude of a Vector

Enter 9. To Quit

3

Enter the size of the Vector

5

Enter values for the Vector

1.0

2.0

3.0

4.0

5.0

The magnitude is: 7.416198487095663

Enter 1. To Add 2 Vectors

Enter 2. To Subtract 2 Vectors

Enter 3. To Find the Magnitude of a Vector

Enter 9. To Quit

2

Enter the size of the Vectors

0

Invalid Size

Enter 1. To Add 2 Vectors

Enter 2. To Subtract 2 Vectors

Enter 3. To Find the Magnitude of a Vector

Enter 9. To Quit

9

Goodbye!

 

Finally:

Submit the source files (.JAVA extension) to the CSCE Dropbox (https://dropbox.cse.sc.edu)