We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I've attempted this problem in five different ways, carefully formatting the output to match the expected results. Despite that, the solution consistently fails on several test cases.
I finally submitted the best version I could, and it passed only 2 out of 8 test cases. At this point, I'm feeling completely stuck.
If anyone has managed to pass all the test cases, I would really appreciate it if you could share your working code. It would help me understand what I'm missing. Thanks in advance!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Currency Formatter
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.text.*;
public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double d = sc.nextDouble();
}
I've attempted this problem in five different ways, carefully formatting the output to match the expected results. Despite that, the solution consistently fails on several test cases.
I finally submitted the best version I could, and it passed only 2 out of 8 test cases. At this point, I'm feeling completely stuck.
If anyone has managed to pass all the test cases, I would really appreciate it if you could share your working code. It would help me understand what I'm missing. Thanks in advance!