Hey guys I'm just getting my feet wet with java and I made this program that asks you how much change you have and then adds them up and tells you how much money you have in dollars. Any tips on the style or in general on this? It runs fine but I don't know if it's coded correctly.
Code:
import java.util.Scanner;
class apples{
public static void main(String[] args){
Scanner change = new Scanner(System.in);
double quarters;
double dimes;
double nickels;
double pennies;
double total;
System.out.println("How many quarters do you have?");
quarters = .25 * change.nextInt();
System.out.println("How many dimes do you have?");
dimes = .1 * change.nextInt();
System.out.println("How many nickles do you have?");
nickels = .05 * change.nextInt();
System.out.println("How many pennies do you have?");
pennies = .01 * change.nextInt();
total = (quarters + dimes + nickels + pennies)/1.;
System.out.println("You have $" +total);
}
}