Obtain principal amount and time and then calculate simple interest as per following specification if the principal is greater than or more than Rs. 10000the rate of interest is 6% otherwise it is 5%

Hi Friends welcome to The Enchanting Team and in this blog I am going to show you How to Make a program to get simple Interest as per following specification if the principal is greater than or more than Rs. 10000, then the rate of interest is 6 % otherwise it is 5 %.
So Lets Begin...........

1.First of all design a layout of your      program like this........



2. Now by Double clicking on the Calculate Button. You will enter to the backend of your program. 
And then enter this code after the line
// TO DO ADD YOUR HANDLING CODE HERE. 
double principal, time, rate;
String txt = PrincipalTF.getText();
String txt1 = TimeTF.getText();
principal = Double.parseDouble(txt);
time = Double.parseDouble(txt1);
if(princial >=10000)
{ RateLabel.setText("6%);
rate = 0.06;
}
else 
{ RateLabel.setText("5%");
rate = 0.05;
}
double intr = principal * time* rate ;
InterLabel.setText(" " + intr) ;

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
3.Your program is ready now run  and Test it. 
And be careful about the alphabet that they are in Capital form or small. 

And 
Text field 1's variable name is PrincipalTF. 
Text field 2's variable name is TimeTF 
Label variable name is RateLabel 
2 label's variable name is InterLabel 
And last Button variable name is Calcbtn. 
It is changed by Right Clicking on the elements, components and then clicking on variable name. 


So hope You like it. Please like, Share and Subscribe for more amazing information. 
~ Utkarsh Vaishnav 
The Enchanting Team 















Comments

Post a Comment

Popular posts from this blog

Learn To Make Calculator In Java NetBeans

Intro To site