Write a program that reads in two floating-point numbers


Write a program that reads in two floating-point numbers and tests whether they are the same up to two decimal places. here are two sample runs. Enter two floating-point numbers: 2.0 1.99998 They are the same up to two decimal palces. Enter two floating-point numbers: 2.0 1.98999 They are different. import java.util.Scanner; class FloatingPoint { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter two floating-point numbers: "); double x = sc.nextDouble(); double y = sc.nextDouble(); if (x== y) System.out.println("They are the same up to two decimal places."); else System.out.println("They are different"); } } This is the code I have come up with so far which i know is incorrect. I need help writing the code that checks these numbers up to two decimal places to see if they are the same or different.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a program that reads in two floating-point numbers
Reference No:- TGS0571411

Expected delivery within 24 Hours