AJ Muni
09-17-2007, 11:46 PM
import java.util.Scanner;
public class Assignment_1
{
public static void main(String args[])
{
double balance; // current balance for account
double depositAmount; // amount to be deposited to account
double withdrawalAmount; // amount to be withdrawn from account
double interestRate ; // e.g 5.0 for 5% interest rate
double interestAmount;// calculated interest
Scanner input = new Scanner(System.in);
System.out.print("Please enter current balance: ");
balance = input.nextDouble();
System.out.print("Please enter deposit amount: ");
depositAmount = input.nextDouble();
}
}
THis is what I get:
Please enter your balance: i enter a number (100) then...
Please enter your deposit amount: i enter another number (100)..
How do I get it to add my initial balance with my deposit amount?
I tried this: System.out.print("Your new balance is: " balance + depositAmount); but that didnt seem to work.. I get an error saying ")" expected...
public class Assignment_1
{
public static void main(String args[])
{
double balance; // current balance for account
double depositAmount; // amount to be deposited to account
double withdrawalAmount; // amount to be withdrawn from account
double interestRate ; // e.g 5.0 for 5% interest rate
double interestAmount;// calculated interest
Scanner input = new Scanner(System.in);
System.out.print("Please enter current balance: ");
balance = input.nextDouble();
System.out.print("Please enter deposit amount: ");
depositAmount = input.nextDouble();
}
}
THis is what I get:
Please enter your balance: i enter a number (100) then...
Please enter your deposit amount: i enter another number (100)..
How do I get it to add my initial balance with my deposit amount?
I tried this: System.out.print("Your new balance is: " balance + depositAmount); but that didnt seem to work.. I get an error saying ")" expected...