I had extended a class called Account from a class Interest
import java.util.*;
import java.io.*;
public class Interest extends Account{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int id = scan.nextInt();
double balance = scan.nextDouble();
double rate = scan.nextDouble();
int noOfYears = scan.nextInt();
Account acc = new Account(id,balance,rate);
double interest = calculateInterest(acc,noOfYears);
System.out.println(interest);
//System.out.println("%.3f",calculateInterest(acc,noOfYears));
}
public static double calculateInterest(Account acc, int noOfYears){
return( acc.rate);
}
}
class Account{
int id;
double balance;
double rate;
public Account(int id, double balance, double rate){
this.id = id;
this.balance = balance;
this.rate = rate;
}
public int getId(){return id;}
public double getBalance(){return balance;}
public double getInterestRate(){return rate;}
}
I got an error as
Interest.java:4: error: constructor Account in class Account cannot be applied to given types; class Interest extends Account{ ^ required: int,double,double found: no arguments reason: actual and formal argument lists differ in length 1 error