Hello all, I am having an issue with a program I am currently writing. I keep getting an
error saying that the variables arn't initilazed....but I did initialize them after I declaired them.
I'm really not sure what the heck I am doing wrong, If someone could take a look at this and
give me some insight as to what I did wrong I would greatly appricate it.
Here is my code;
CODE
/*
Programmer: Micheal W. Smith
Date: October 8, 2008
Purpose: Write a Java Program that Prompts the User to enter number of quaters
number of dimes, number of nickles, and number of pennies. The program
will add the coins and give the user the total for the coins entered by
the user in dollars and cents.
*/
import java.util.Scanner;
public class money
{
public static void main(String [] args)
{
//Declaring Variables
int quarters;
int dimes;
int nickels;
int pennies;
int dollars;
double TotalAmount = 0.0;
//Initializing
quarters = quarters * 25;
dimes = dimes * 10;
nickels = nickels * 5;
pennies = pennies * 100;
Scanner keyboard = new Scanner(System.in);
//Input prompt from user
System.out.println("Enter the numbers of Quaters ");
quarters= keyboard.nextInt();
System.out.println("Enter the number of Dimes ");
dimes = keyboard.nextInt();
System.out.println("Enter the number of Nickles");
nickels = keyboard.nextInt();
System.out.println("Enter the number of pennies");
pennies = keyboard.nextInt();
//algorythm used in final calculation
TotalAmount = quarters + dimes + nickels + pennies;
System.out.println("Your Dollar Amount is " + TotalAmount);
}
}