From 4ec582b9eb81d285f6bf48ee5cf1bbbe2545e894 Mon Sep 17 00:00:00 2001 From: markofornoliak <130382040+markofornoliak@users.noreply.github.com> Date: Sun, 8 Feb 2026 00:58:18 +0100 Subject: [PATCH] Change coins variable type to double and defined variable dollars before calcucations Changed the coins variable type to double for precision in conversion. --- 2-variables/10-club-penguin.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/2-variables/10-club-penguin.java b/2-variables/10-club-penguin.java index 132efd0..66b478c 100644 --- a/2-variables/10-club-penguin.java +++ b/2-variables/10-club-penguin.java @@ -11,11 +11,12 @@ public static void main(String[] args) { System.out.print("Welcome to the Club Penguin money converter!"); System.out.print("How many coins do you have? "); - int coins = scanner.nextInt(); + double coins = scanner.nextDouble(); - double dollars = coins * exchangeRate; + double dollars; + dollars = coins * exchangeRate; System.out.println("You have the following amount of dollars:"); System.out.println(dollars); } -} \ No newline at end of file +}