Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA-- Why is my output coming out as 0's? thank you The problem is the output is coming out as 0.0 every time which is

JAVA-- Why is my output coming out as 0's?
thank you image text in transcribed
image text in transcribed
image text in transcribed
The problem is the output is coming out as 0.0 every time which is obviously incorrect. No matter what values are inputted, output is 0.0 not the correct number
image text in transcribed
! D stickFigure.java D pointsandLines.java 23 D basicFractions.java D conditionsjava B1 import java.util.Scanner; 3 public class pointsandlines t .jar -/Libran brary/JavalJa public static void main(String[] args) Library/Java 6 ibrarylJaval 8 ar- /Library 9 brary/Java/J 10 /Library/Ja 11 getCoordinatesO); riseRunCe, 0, 0, ); xyMidpointC0, e, e, ); outputce, 8, e): double] temp xyMidpoint(1,2,3,4); double midpointX temp[0]; double midpointy temp[1] 14 Library/Java /Library/Ja' : 16 jar /Librar 17 vider.jar- 18 jar - /Libra 19 /Library/J 20 Library/Jav 21 jar -/Syste22 } public static void getCoordinatesO f System.out.println"Please enter your first x"); Scanner scan-new Scanner(System. in); double x1 scan.nextDoubleO System, out.println" Please enter your first y) double y1 -scan.nextDoubleO: System.out.println Please enter your second x") double x2 scan.nextDoubleO; System.out.println"Please enter your second y); douhle ?sean nextDouhle ar - /Librar 28 arylJava/Ja 29 /LibraryConsole 3 Library/Ja Please enter your first x ibrary/Java 30 rary/Javal.31 terminated> pointsandLines (Java Applicationl /Library/Java/JavavirtualMachinesjidk1.8.0 191. jdk/Contents/-Home/bin/java (Mar 5, 20 Libraryl2 Library Please enter your first y /Java1 Library/Ja Please enter your second x brary Please enter your second y der.jar - ar -/Libra Thank you. The equation of Cy2-y1)/Cx2-x1) will calculate your rise over run. Library Your midpoint is (0.0,0.0) ar- /Syste File Edit Source Refactor Navigate Search Project Run Window Help eclipse-workspace- dLines java pointsandLinesjava 23 M basicFractions java double y2 scan.nextDoubleO: conditionsjava stickFigure java 32 s.jar- /Librar 34 brary/JavaJa 35 Library/Java 36 ibrary/Java 37 ar - /Library 38 39 Library/Jar 41 public static double riseRun double x1, double x2, double y1, double yz) t System.out.printlnC"Thank you. The equation of braryJava/J + "(y2-y1)/(x2-x1) will calculate your rise over run. r-Libraryl 4 r-/Libraryl 43 Library/Java 4 double slopeResult (y2-yl)/(x2-x); Library/Ja 45 jar /Librar 46 47 return slopeResult vider,jar- 48 jar . /Libra Library/J 50 ibrary/Jav 51 jar -/Syste 52 53 54 public static doubleD3 xyMidpoint(double x1, double x2, double yl, double y2) t double midpointx - (x2-x1)/2; double midpoint (y2-y1)/2; 56 57 Librar 58 ry/Java/Ji59 rary/Java 60 ary/Java/. /Library Console X ry/Java/J ibrarylJar Please enter your first x Libraryl2 Library/ Please enter your first y ary Java 1 brary/Ja Please enter your second x Librar3 r.jar -/ double points new double[2]; points[0] midpointX; cterminated> pointsandLines [Java Application]/LibrarylJava/JavaVirtualMachines/jdk1.8.0.191.jdk/Contents/Home/bin/java (Ma Please enter your second y Libr Thank you. The equation of (y2-y1)/(x2-x1) will calculate your rise over run. brarylJ Your midpoint is (8.0,0.0) rylJav Your slope is 8. /Syste D stickFigure java D pointsandLines javaD basicFractions.java D conditions.java 48 49 50 ar 51e public static doubleD] xyMidpoint(double x1, double x2, double y1, double y2) f J 52 double midpointX -(x2-x1)/2; va 53 a/. 54 double midpointY (y2-y)/2 ILI 56 57 58 59 y60 a double points new double[2] points[e] midpointx; points[1]- midpointY; return points; 61 a62 ar 63 64 65 public static void output(double midpointx, double midpointY, double slopeResult) System.out.printlnC Your midpoint is ("midpointXmidpointY)"); System.out.printlnC Your slope is +slopeResult) 70 71 72 73 74 75 76 Console pointsandLines (Java Application) /LibrarylJava/JavaVirtualMachines/jdk 1.8.0.191.jdk/Contents/Home/bin/java (Mar 5, 2019, 8:24:1 Please enter your first x Please enter your first y Please enter your second x Please enter your second y Thank you. The equation of (yz-y1)/(x2-x1) will calculate your rise over run. Your midpoint is (e.0,0.8) Your slope is 0.0 data.jar-/Librar 63 e-provider,jar - 64 cs11.jar - /Libra 65 66 Sjar-/Library/J 67 ar - /Library/Jav68 olkit.jar -/Syst 69 70 71 72 public static void output(double midpointX, System.out.println("Your midpoint is (" d- System.out.printlnC"Your slope is"slo Lines ces,jar -/Libran 74 /Libraryl/Java/Je -/Library/Java\ 75 76 77 /Library/Java/ ts.jar. /Library/ |Console Library/Java/J cterminated> pointsandLines [Java Application]/Library/JavalJavaVirtualM ar -/Library/Ja Please enter your first x jar-/Libraryl. 2 a.jar - /Libraryl. Please enter your first y - /Library/Java 1 ar - /Library/Ja Please enter your second x ata jar -/Librar provider.jar Please enter your second y 11jar-br ank you. The equation of (y2-y1)/(x2-x1) will calculate you jar -/LibrarylJ Your midpoint is (0.0,0.0) r-/Library/Javi Your slope is 0.0 olkit.jar ISyste

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions