0% found this document useful (0 votes)
3 views1 page

Java Programming Mystic Line Code Editor

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java Programming Mystic Line Code Editor

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

5/7/24, 1:05 PM Java Programming Mystic Line Code editor

[Link] [Link]

1 import [Link].*;
 2 public class UserInterface {
3
4 public static Calculate calculateSlope() {
5
6 return (x1,x2,y1,y2) ->{
 7 if(x1-x2==0)
8 return "Slope of the line is 0";
9 else

10 return "Slope of the line is "+(y2-y1)/(x2-x1);};
11 }
 12
13 public static Calculate calculateMidpoint() {
14
15 return (x1,x2,y1,y2) ->{
16 return "Mid point of the line is ("+((x1+x2)/2)+","+((y1+y2)/2)+")";};
17 }
18
19 public static void main(String[] args) {
20 Scanner sc= new Scanner([Link]);
21
22 [Link]("Enter the values for x intercepts and y intercepts");
23 int x1=[Link]();
24 int x2=[Link]();
25 int y1=[Link]();
26 int y2=[Link]();
27
28 Calculate slope=calculateSlope();
29 String sloperesult=[Link](x1, x2, y1, y2);
30 [Link](sloperesult);
31
32 Calculate midpoint=calculateMidpoint();
33 String midpointresult=[Link](x1, x2, y1, y2);
34 [Link](midpointresult);
35 }
36 }
37

Terminal Feedback

[Link] 1/1

You might also like