JAVA thanks
Excericse 6-----------------Code-------------/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package chegg1;import java.util.Scanner;/** * * @author vijay */class CartesianPoint{ double x,y; CartesianPoint(double x,double y){ this.x=x; this.y=y; } CartesianPoint(){ x=0; y=0; } double distanceFrom(CartesianPoint q){ double ans=Math.sqrt((x-q.x)*(x-q.x)+(y-q.y)*(y-q.y)); return ans; } boolean IsOnXaxis(){ if(y==0)return true; return false; } boolean IsOnYaxis(){ if(x==0) return true; return false; } }public class Chegg1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc=new Scanner(System.in); System.out.println("Enter the x and y coordinate"); double x,y; x=sc.nextDouble(); y=sc.nextDouble(); CartesianPoint point1=new CartesianPoint(x,y); System.out.println("Enter the x and y coordinate"); x=sc.nextDouble(); y=sc.nextDouble(); CartesianPoint point2=new CartesianPoint(x,y); System.out.println("distance between two points is: "+point1.distanceFrom(point2)); } }------------------------Output------------run:Enter the x and y coordinate15Enter the x and y coordinate24distance between two points is: 1.4142135623730951BUILD SUCCESSFUL (total time: 3 seconds)Excercise 7---------------Code----------------------/* * To change this license header, choose License Headers in Project Properties. * To chan ... See the full answer