mardi 21 février 2017

Assigned Operator Expression + left-hand must be variable (for integers in java)

I am currently designing a very basic interest calculator. As my knowledge of the java programming language is still quite limited I appear to have run into a problem. There is a line in the program, a single if statement that will not allow me to run the program, it is easy to find it is the only one. The problem is I keep getting stopped for two reasons, one I am being told is that the "left-hand side of the assignment must be a variable" and second "insert AssignedOperator Expression". I know the topic may have been covered before, but I have not found an answer to suit my needs, any help would be great.

package Unit_1_Review;

import java.util.Scanner;

public class Interest_Calculator_Assignement {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        double initamount, interestrate,interest2,principal,remamount;
    {   int count = 1;

        System.out.print("Please enter the amount you wish to borrow:");
        initamount = input.nextDouble();
        System.out.print("Please enter the borrowing interest rate:");
        interestrate = input.nextDouble();



        while (count <= 10)
        {   
            System.out.println(count);
            count+=1;

            interest2 = ((initamount*interestrate)/12);
            principal = ((initamount*interestrate) - interest2);
            remamount = (initamount - principal);

            *if (count == 2);
                (remamount == initamount);*






        System.out.println("Initial Amount: $" + initamount);
        System.out.println("Interest Rate:" +interestrate);
        System.out.format("Interest:$%.2f", interest2);
        System.out.format("\nPrincipal:$%.2f", principal);
        System.out.format("\nAmount Remaining:$%.2f", remamount);
        System.out.println("        ");


        }

    }

}

}   

Aucun commentaire:

Enregistrer un commentaire