0

merry Christmas!

import java.io.*;

public class NickelDollar {
    public static void main(String[] args){
           
            BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
       
       
                    String num = "";
                System.out.println("How much Nickel do you have?" );
                System.out.println("How much Pennies do you have?" );    
       
        try
        {    
        num = BR.readLinne();
        int nickel = Interger.parseInt(num);
        num = BR.readLinne();
        int pennies = Interger.parseInt(num);
        int dollar = 0;
        int x = (nickel*5)+ pennies;
            dollar = x/100;
           
        System.out.println("You have" + x);
       
       
        }
        catch(IOException e) {
            Sytem.out.println("Error");
        }
           
        }
    }
}

I am new to programming, and I am making this ajava program.
The goal of the program is to convert the Inputed Nickel and pennies into dollar and cents.
And how could I make the output of dollar into something like this:
10 dollars and 4 cents.
Instead of just
10 dollars.

Any help will be appreciated, thanks

Edited by peter_budo: Code tags correction

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by nomemory
1

Check out the spelling. You've written: "Sytem", "Interger", "readLinne()".

Afther that, leave Buffers (reading data input from the user is not as simple as it's in C or C++) alone for a while, and try to grasp the Java Basics.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.