Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA: Why is my output consistantly 0? Please help me with my code eclipse-workspace-Pointsandtinesysre/polntsd ) stickFigure java pointsandLines javabasicFractions java Conditions java 1 import java.util.Scanner;

JAVA: Why is my output consistantly 0? Please help me with my code
image text in transcribed
image text in transcribed
image text in transcribed
eclipse-workspace-Pointsandtinesysre/polntsd ) stickFigure java pointsandLines javabasicFractions java Conditions java 1 import java.util.Scanner; 3 public class pointsandLines t 5e public static void main(String[] args) { getcoordinatesO riseRunCo, e, e, e) xyMidpointCe, e, e, e); output(0, e, e); a 11 12 13 14 15 16 17 18 public static void getCoordinatesO t System.out.println"Please enter your first x") Scanner scan new ScannerCSystem.in); double x1 scan.nextDoubleO; System.out.println("Please enter your first y); double yl -scan.nextDoubleO ra 19 21 24 25 System.out.println("Please enter your second x"); double x2 scan.nextDouble; System.out.println"Please enter your second y"; double y2 -scan.nextDouble); 27 30 Console 3 sterminated> pointsandLines [Java Application] /LibrarylJavalJavaVirtualMachines/jdk 1.8.0-191.jdk/Contents/Home/l a Please enter your first x Please enter your first y Ja Please enter your second x n Please enter your second y re Thank you. The equation of (y2-y1)/(x2-x1) will calculate your rise over run. d Your midpoint will be calculated by O2-X1/2),(Y2-Y1)/2. av Your midpoint is (8.0,0.8) ste Your slope is 0.0 8.18 GB Free Edit Source Refactor Navigate Search Project Run Window Help - Eclipse 31 32 ibrar34 public stotic woi d riselun double xi, double x2, double y1, double y2) t System.out.print inC"Thank you. The equation of yJava 36 Javal 37 brary 38 ava39 + (y2-y1)/(x2-x1) will calculate your rise over run. double slopeResult (y2-y1)/(x2-x1): rary43 Jav44 public static void xyMidpointCdouble x1, double x2, double y1, double y2) t ibrar 46 ar- 47 Libra 48 49 double midpointx (x2-x1)/2; double midpointY (y2-yl)/2 Systen.out.printin("Your midpoint will be calculated by 02-X1/2),(12-Y)/2.9; Syste s2 53 54 56 57 public static void output (double midpointx, double midpointY, double slopeResult) t bran System, out . println("Your midpoint is (" + "idpointX +-+ midpointY +-)"); 59 System.out.println"Your slope is "slopeResult); ary Console 3 a aterminuated- pointsanduines Jave Application) Aibrary Java/JavavirtualMachines/jak1 8.0.191 jak/Contents/Home/binjava (Mar s, 2019, Please enter your first x ary. 1 aryl Please enter your first y ava 2 Ja Please enter your second x Please enter your second y a bra Thank you. The equation of (y2-y1)/(x2-x1) will calculate your rise over run Your midpoint will be calculated by (x2-x1/2),CY2-Y1)/2. Javi Your midpoint is (e.0,0.e) yste Your slope is 8.0 Writable system.out.printinc inank you. ine equatton or + "(y2-y1)/(x2-x1) will calculate your rise over run." Librarg 40 Javald41 rylJava42 Java43 Library44 45 double slopeResult 2-y)/x2-x): Java/J 46e public stotic void xMidpoint(double x1, double x2, double y1, double y2) t r47 brary 49 double midpointx-Cx2-x1)/2; double midpointY -(y2-y1)/2; System.out.printlnC"Your midpoint will be calculated by (X2-x1/2),CY2-Y1)/2.) aryJa 51 Librar 52 rjar-A 53 Libra 54 aryJav57 Syste 58 public static void output(double midpointX, double midpointY, double slopeResult) t System.out.println"Your midpoint is CmidpointXmidpointY System.out.println"Your slope is "slopeResult) 61 /Librar 63 Java/J rylJava 66 Library Console 3 Java/d terminateds pointsandL ines [Java Application] /Library/Java/JavavirtualMachines/jdk1.8.0.191 jdk/Contents/Home/bin/ja rarylJa Please enter your first x ibrary. : 1 ibraryl Please enter your first y ry/Java 2 rarylJa Please enter your second x /Librar Please enter your second y LibrThank you. The equation of (y2-y1)/(x2-x1) will calculate your rise over run. brary Your midpoint will be calculated by (X2-X1/2), CY2-Y1)/2 arylJavi Your midpoint is (e.0,0.0) /Syste Your slope ts e.o Writa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions