Question: Vertical Lines Additional Requirements Course Coding Conventions: organizations use coding conventions to ensure consistency in their programs and to facilitate code maintenance; in this course,
Vertical Lines Additional Requirements
Course Coding Conventions: organizations use coding conventions to ensure
consistency in their programs and to facilitate code maintenance; in this course, we will
start using the following:
Program Description: your program must have a comment at the top briefly
describing what the program does. Usually, one sentence is enough; for
example: This program calculates the area of a circle given its radius.
Variable naming: use lower camel case; do not use underscore. Example:
total Cost instead of totalcost
Constant names: use all uppercase; use underscore to separate words.
Example: MAXWIDTH
Grading Criteria
Program Description:
Program follow course coding conventions:
Program uses only the integer type:
Check to avoid divide by zero error:
Accuracy of results:
Notes:
You may only use material from Chapters of the eTextbook; otherwise, your
program will not be accepted.
Programs with syntax errors will not be accepted.
Email me at
FAHernandez@dcccdedu if you have any questions Programming Assignment #
COSC Programming Fundamentals II
Dallas College Fall
Instructions
Write a Java program to determine whether two straight lines are perpendicular. The program must prompt the user for the values of coordinates for two points of each line. Coordinate figures must be read as integers.
Example: in the graph below, the line is defined by the pairs: and ; whereas the line CD is defined by and
Premises
For a line represented by two points: and the slope of such line, m is determined by:
Given two lines with slopes m and m respectively, the lines are perpendicular if the product of their slopes yields :
The program should avoid a "divide by zero error" by checking for vertical lines. In a
vertical line: ; consequently:
Note: If one of the lines is found to be verticalhorizontal all the program needs to do is
check to see if the other line is horizontalvertical to determine whether
they are
perpendicular or not.
Output
The program output should be either:
"Lines are perpendicular"
Or
"Lines are not perpendicular"
The program should not produce any other output. For example, if the program
detects a vertical line, do not display: "Divide by zero error" and exit. Instead, the output
should be one of the two shown above.
Sample program output
Sample Run #:
Enter coordinates for the first line:
Enter coordinates for the second line:
Lines are perpendicular
Sample Run #:
Enter coordinates x y x y for the first line:
Enter coordinates for the second line:
lines are not perpendicular
Testing
Assume two lines are represented by their coordinates, as follows:
Line : and
Line : and
Given the following values, your program should produce the corresponding output: do this in java
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
