I'm learning java for the first time and am making a program that outputs how much money is in my debit card as well as how much I owe. Here is my code:
public class Main {
public static void main(String[] args) {
double bankAccountNumbers = Main.calculateMoneyExpenditures(6350.46, 2700.00, 115.75);
System.out.printf("Money left in debit card: $%,.2f%n", bankAccountNumbers);
System.out.printf("Money left before going into debt: $%,.2f%n", bankAccountNumbers);
}
public static double calculateMoneyExpenditures(double debitCardMoney, double creditLimit, double amountOfDebt) {
double moneyInCard = (debitCardMoney);
return moneyInCard;
double amountToSpend = (creditLimit);
return amountToSpend;
double amountOwed = (creditLimit - amountOfDebt);
return amountOwed;
}
}
However, when I compile this code into Repl.it, I get the following error:
enter code here Main.java:11: error: unreachable statement
double amountToSpend = (creditLimit);
^
Main.java:13: error: unreachable statement
double amountOwed = (creditLimit - amountOfDebt);
^
2 errors
Can someone please tell me how I can resolve this error for this code and future projects where I have to follow these scoping rules?