Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java application that will have the user to enter for the x and y coordinates of two Cartesian1 points (Say, A & B),

Create a Java application that will have the user to enter for the x and y coordinates of two Cartesian1 points (Say, A & B), then calculates and displays the distance between them. The program should also calculate the slope and midpoint of the line AB. Assume that the coordinate values are whole numbers.

image text in transcribed

image text in transcribed

Getting User Input Prompt the user for the x value followed by the y value. Assume the user will separate the two using tab or space. For this lab, assume the user will enter whole numbers in a reasonable range. You do not have to include input validation at this point. Use mathematical functions where applicable. Calculating the Distance, Slope and mid-point between Two Points A. The formula for distance between two points having the coordinates A (x1, y1) and B (x2, y2)2 is: d= (12 X)2 + (y2 y)2. = Note that this value may not be a whole number. B. The slope of the line is calculated for a line AB with two points A (x1, y1) and B (x2, y2) as: y2-y, m = X - X, C. The mid-point of a line AB with two points A (x1, y1) and B(x2, y2) is: (x2,42) (179) r1 +22 91 + y2 2 2 (21,y) Evaluation Your submission will be evaluated based on the following criteria: Efficient Code: Program uses variables where and only when necessary; program does not define variables that are never used, nor does it use too many variables for . - unnecessary tasks; program logic is written concisely and is not cluttered with unnecessary tasks. Use of appropriate mathematical functions. Functionality: program functions according to specifications - input and output is done on the console using the techniques discussed in class; variables are used to store user inputs until they are needed for output. Programming Style: proper indentation and spacing, of comments/documentation; all identifiers are descriptive and valid; variables are defined with appropriate types and converted when required. Other: all instructions regarding submissions and program specifications have been followed; submission was completed and submitted as requested in a timely fashion; techniques discussed in class have been used. use

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago