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
Shoes Mosh 0 Newbie Poster
iamthwee
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster
stultuske 1,116 Posting Maven Featured Poster
jwenting 1,889 duckman Team Colleague
Shoes Mosh 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
Shoes Mosh 0 Newbie Poster
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.