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