Your Link Will Open Shortly


Search Jobs
Search From 1914 Posts
Want Job Updates?

Join 49828 Freshers

Sir help me in finding the below java programs for IBM using Buffered Reader

Posted On 18-02-2017 At 11:53 PM


Raghavula Soundarya
REF ID : 14357

1)WAP to convert the alternate characters of the string to upper case . The first letter of the string has to be Capital.
I/P:We are the worlD
O/P: We ArE tHe WoRlD

2)Transform string to lowercase alphabet character by replacing each letter with the subsequent character in english alphabet

Eg: I/P : hello

O/P: ifmmp

Facing Problem? Try These Login Options
| Facebook | Google

Comments


Tarun Jain
February 18, 2017

You can convert alternate letter to upper case like this

class AleternatUper
{
public static void main(String…s)
{
String s1=”hello java”;
char ch;
String s3=””;
for( int i=0 ; i < s1.length() ; i++ ) { ch=s1.charAt(i); if(i%2==0) s3=s3+Character.toUpperCase(ch); else s3+=ch; } System.out.print(s3); } }


Raghavula Soundarya
February 19, 2017

thank u sir : )


Tarun Jain
February 19, 2017

For increment check this basic example

input : ABCD, output : BCDE

import java.util.Scanner;
import java.io.*;
class Ideone
{
public static void main(String args[])throws IOException
{
String str,inc=””;
int i;
Scanner sc=new Scanner(System.in);
str =sc.nextLine();
for(i=0;i < str.length();i++) { if(str.charAt(i)==' ') { inc=inc+str.charAt(i); } else { inc=inc+(char)(1+str.charAt(i)); } } System.out.println(inc); } }


Tarun Jain
February 19, 2017

check this pdf file
it has some basic programs compiled in one place that will help for IBM Drive
http://gofresher.org/wp-content/uploads/2017/02/IBM-Java-Program.pdf


Tarun Jain
February 19, 2017

Logic remains same whether using BufferedReader or Scanner


Raghavula Soundarya
February 19, 2017

Thats a great help sir! thank u ..!!


kumar harsh
February 19, 2017

import java.util.*;
import java.lang.*;
import java.io.*;

class Code1
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String temp=””;
String name = reader.readLine();
for(int i=0;i<name.length();i++)
{
if(i%2==0)
temp+=Character.toUpperCase(name.charAt(i));
else
temp+=Character.toLowerCase(name.charAt(i));

}
System.out.print(temp);
}
}

Leave a comment below

You must be LOGGED IN to post a comment.