Share on Google+Share on Google+

danny
Ques
1 Answer(s)      6 years and 3 months ago
Posted in : Java Beginners

wap to calculate Compound intrest

wap to convert a string into lcase ucase concat length

Ads

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










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
Advertisements
provide me the program for that ques.
provide me the program for that ques.  wtite a program in java there is a class readchar.the functionality of this class is to read a string from the console and display the characters of that string on the console.   
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
give the code for this ques///
give the code for this ques///  write a program in java which contains a class simple. this class contains 4 members variables namely a,b,c,and d. This class also contains 3 constructors of 2,3 and 4 arguments and a function
about interview ques. - Java Interview Questions
about interview ques.  i give a interview for java.. they ask me. what is System.out.println(); what is its write ans...  Hi Friend, It is the syntax of Java used to display a string on the console window
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
jsp online ex
jsp online ex  wat is the parametr u passed ...ques
Need Help on JMS - JMS
Need Help on JMS   Hi, In my application i need to create my own ques and my own QueueConnectionFactory..... Plz tell me how to create the same... Any help is appriciated,.. Thanks in advance
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
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
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
java - Java Interview Questions
..tat is when a mixture of 4 or 5 ques in 1 single question which is real
Project realated help - JSP-Servlet
all users groups and ques and others thing r working but now em on final stage
java - Java Beginners
java  Ques-Give the output of the following code : class numeric { static int fact (int n) { int p=1; int i=n; while (i >=2) { i--; p=p*i; ) refurn p; } public static void main (String args []) { int X=4
Database Design
`onlinexamination`; Then create the table new_ques which contains the queshon. CREATE TABLE `new_ques` ( `quesno` int(10
onfly conversion of jsp to pdf (urgent) - Development process
set of questions, user select the page 1 ques and click next .there is another... page in which we show the question id, ques answers. now the problem is that i
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
On HTML and JavaScript - Java Beginners
should not get select as option Hope my ques is clear
online test project on java using servlets and jsp
(rs.next()){ %> <%=i%><%=rs.getString("ques")%>" name
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
;%=rs.getString("ques")%></td><td><input type="radio" value="<
online examination
("ques")%></td><td><input type="radio" value="<%=rs.getString
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads