Hi Siens,
A lot of changes need to be made in your code, as it is missing a lot of code.
The code is as follows:
import java.util.Scanner;
public class Interest
{
static double salary;
static double rate= 0.05;
static double earned;
public static void main(
String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("What is the original amount?");
salary = input.nextDouble();
calculateInterest();
System.out.println("Interest earned on $" + salary + " at 5% would be $"+ calculateInterest() );
}
public static double calculateInterest()
{
earned = salary * rate;
return earned;
}
}
As far as i know this is proper code, let me know if any query.
Corrections are welcome as i am also new to programming.
Thanks.