
wap to calculate Compound intrest
wap to convert a string into lcase ucase concat length

plz post coding plz plz plz

Hi Friend,
Try the following codes:
1)
import java.text.*;
import java.util.*;
public class CompoundInterest
{
public static void main( String args[] )
{
StringBuffer buffer=new StringBuffer();
Scanner input=new Scanner(System.in);
System.out.print("Enter Principal: ");
double p=input.nextDouble();
System.out.print("Enter Rate: ");
double r=input.nextDouble()/100;
System.out.print("Enter Years: ");
double y=input.nextDouble();
double amount=0;
DecimalFormat df = new DecimalFormat( "0.00" );
buffer.append( "Year\tAmount on deposit\n" );
for(int year = 1; year <= y; year++){
amount = p * Math.pow( 1.0 + r, year );
buffer.append( year + "\t" + df.format( amount ) + "\n" );
}
System.out.println(buffer.toString());
}
}
2)
import java.util.*;
public class StringExample4{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.print("Enter String: ");
String st=input.nextLine();
String lowercase=st.toLowerCase();
System.out.println("String in Lowercase: "+lowercase);
String uppercase=st.toUpperCase();
System.out.println("String in Uppercase: "+uppercase);
String concatenatedSt=st.concat("World");
System.out.println("Concatenated String: "+concatenatedSt);
int len=st.length();
System.out.println("Length of string: "+len);
}
}
Thanks