Ques

Ads
 

Ques

wap to calculate Compound intrest

wap to convert a string into lcase ucase concat length

View Answers

January 11, 2011 at 10:41 AM

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

Ads









Related Tutorials/Questions & Answers:
Ques
{ public static void main(String[] args) { int num=3; int p = num; int q = 0...;= q; k++) System.out.print(" "); q+=1; } } } Thanks
Ques
Advertisements
give the code for this ques///
give the code for this ques///  write a program in java in which there is a clss readline. the functionality of this class is to read a string from the console and display it on the console .A point that should be keep in mind
i have an ques. of advanced java
i have an ques. of advanced java  write a wap to implement AWT by login form
String Ques
JAVA INTERVIEW QUES
jsp online ex
jsp online ex  wat is the parametr u passed ...ques
jsp
jsp  ques: how to insert data into database using mysql
jsp
jsp  ques: how to insert data into database using mysql
jsp
jsp  ques: how to insert data into database using mysql
jsp
jsp  ques: how to insert data into database using mysql
Important Interview Questions in Core Java
with a fresher or having experience of 1-2 years. Read carefully: Ques: What is Java? Ans...-is-java.shtml Ques: Is java platform Independent? Or What is the most... to run and execute at any platforms like Windows, Linux, MacOS and Solaris etc. Ques
JSF Basic Interview Questions
will improve the chances of your success. So have a look on it. Ques: What is JSF.../whatisjsf.shtml Ques: What is required to get started with JSF? Ans... 3.2.x and others. Ques: What is the JSF architecture? Ans: JSF
patterns
patterns  who ever answered my previous ques thank u sooooo much!!!!!!!!!! though i was able to solve most complicated progms in java patterns are a night mare for me. thank u once again.can u help me on how to print
ONLINE EXAM CODE SPLIT
ONLINE EXAM CODE SPLIT  hi.. im developing online exam for c programming in jsp.. i read the question from database as a string suppose String ques="#include<stdio.h>main(){int i;for(i=0;<100;i++){printf("hai
Database Design
`onlinexamination`; Then create the table new_ques which contains the queshon. CREATE TABLE `new_ques` ( `quesno` int(10
Java Virtual Machine(JVM)
Ques:-What is Java Virtual Machine? Ans:- Java Virtual... and converts this into the machine code. Ques 2... my first java program Ques 3: - Memory Management with JVM ? Ans
online examination
("ques")%></td><td><input type="radio" value="<%=rs.getString
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
;%=rs.getString("ques")%></td><td><input type="radio" value="<
online test project on java using servlets and jsp
(rs.next()){ %> <%=i%><%=rs.getString("ques")%>" name
online examination system project in jsp
;/td><td><%=rs.getString("ques")%></td><td><input type
hi
;<td><%=rs.getString("ques")%></td><td><input type
online examination system mini project
;%=i%></td><td><%=rs.getString("ques")%></td><td>
urgent help for inserting database in a project
; panelSouth.add(choice_button[0]); mark_ques...; mark_ques(); displayquestion..._ques(); displayquestion(); checkteststatus
urgent help for inserting database in a project
; panelSouth.add(choice_button[0]); mark_ques...; mark_ques(); displayquestion..._ques(); displayquestion(); checkteststatus
Radio Button Problem in jsp.
;<td><%=rs.getString("ques")%></td><td><input type
jsp
jsp  ques: how to insert data into database using mysql   //index.jsp <%-- Document : index Created on : May 20, 2013, 1:20:04 PM Author : ignite178 --%> <%@page contentType="text/html
chn.ilp.test
=(Map.Entry)itr.next(); QuestionVO ques=(QuestionVO)me.getValue();; %> <... ques=(QuestionVO)me.getValue();; %> <tr> <td><

Ads