The bank already has a Java application. But they want certain new features to be added and some existing functionality to be changed as per their new policies. For this, Angelina needs to address the following issues: [20 Marks]
1. There is a class named Accounts which calculates the interest on a particular account. The following code snippet generates compilation error: [5 Marks]
class Accounts
{
int principal; // Data members of the class
int interest;
int time;
int amt;
public Accounts ()
{
principal = 50000;
interest = 5;
time = 3;
return principal, interest, time;
}
public void calc()
{
amt= principal*interest*time/100;
System.out.println(“The amount is :” + amt);
}
public static void main(String args[])
{
Accounts l1= new Accounts ();
l1.calc();
}
}
What is the cause of error? Give reasons in support of your answer
Member Avatar for iamthwee

We DO NOT ANSWER homework questions.

Iamthwee is correct, we don't. If you post whatever code you have written yourself, and ask a meaningful question about how to complete the project, we should be able to help, but we will not do your work for you.

just try to compile it, and see for yourself.
it's one line that 'll block. if you know just the least bit of your course, you'll easily spot it.

if you don't, you haven't read your coursenotes.

which bank is that? Just want to make sure I never open an account there.

plis guys help me out of this am an amateur in java so i have been given this assignment...i know you can help me..

the problem i found is that 'void method does not return a value'.

that is not the problem.
void means: returns nothing..

check your constructor.

ok i will check it thanks in advance Stultuske!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.