Program To Convert All Vowels To Capital Letter In A Sentence?

Jul 3, 2014

i am new to programming skills it may be silly question for experience but for me it's new thing. actually i tried a lot but i am facing problem when i trying to take input through Scanner. if i will take input a sentence directly as a string it's working . but when i am trying with Scanner the first word is showing next are not showing

public class Demo2
{
public static void main(String[] args)
{
String s1="hi how are you";
s1=s1.replace('a', 'A');
s1 =s1.replace('e', 'E');
s1 =s1.replace('i', 'I');

[Code]...

this is working properly.

but when i trying with Scanner i am facing problem.

public class Demo2
{
public static void main(String[] args)
{
java.util.Scanner scn= new java.util.Scanner(System.in)
String s1=scn.next();
s1=s1.replace('a', 'A');

[Code]...

View Replies


ADVERTISEMENT

Strings - Change Every Capital Letter Into Small Letter And Vise Versa

Oct 22, 2014

I have a problem with functions connected to strings.

I have a random String, e.g. "Hello World!" and I have to change every capital Letter into a small letter and vise versa. This alone would be fairly simple, but I have to do it with two other strings.

lowercase= "abcde...z" and

uppercase="ABCDE...Z". Every small letter stands at the very same position as the capital letter, but in the other string.

There should be a letter for letter search in lowercase and uppercase for the letters of "Hello World".

How I could solve the task, however I need a way to search the first string, here "Hello World", according to position. A statement which does: "Give me the letter of position x". This found letter should be able to be stored in a variable or else be able to be used by another statement. And it should be compatible with a for lope.

View Replies View Related

Removing All Vowels From A Sentence

Jan 28, 2015

How do I write a program that has words in an array and output that array without the vowels?

View Replies View Related

Check If A Sentence From User Has Specific Letter?

May 1, 2014

I am trying to write a simple program that checks if a user's input has a specific letter using the ".contains" method but its not doing what i wanted to do. here is my code below.

import java.util.Scanner;
public class secret
{
public static void main(String args[]) {
Scanner sc;
char hidden='a';
String guess;

[Code] ....

View Replies View Related

Convert Integer To Letter Grades

Jan 31, 2014

/*This program will convert integer grades to letter grades and say how many A's, B's, C's, D's , F's do we have

public class DSlab3 {
private char LetterGrades;
private int IntegerGrades;
//default constructor
public DSlab3() {
LetterGrades =' ';
IntegerGrades = 0;

[Code] .....

View Replies View Related

Convert The First Letter Of Every Word In A String To Uppercase?

Sep 20, 2014

I'm trying to convert the first letter of every word in a String to uppercase. I've managed to isolate the first letter of every word and then make it uppercase but I don't know how to replace it.

public static StringBuffer makeUpperCase(){
String str = String.valueOf(input2);
for(int i = 0; i < str.length(); i++){
if(str.charAt(i) == ' '){
char var = str.charAt(i + 1);
var = Character.toUpperCase(var);
System.out.println(var);
}
}

View Replies View Related

Program That Continuously Asks For Alphabet Letter And Stops When Non-Alphabet Letter Entered

Oct 8, 2014

Write a program that continuously asks for an alphabet letter, and stops when a non-alphabet letter is entered. Then output the number of upper case letters, lower case letters, and vowels entered ....

View Replies View Related

Write Program To Sort Names According To Number Of Vowels?

Feb 15, 2014

write a program to sort names according to number of vowels sort({sam,ratan,alok,raj}) the op is {sam,ratan,alok,raj}

View Replies View Related

Write A Program To Reverse Each Word In Line (sentence)

Jul 3, 2014

Write a program to reverse each word in line(sentence)?

View Replies View Related

Make Program That Tells User To Type Sentence?

May 21, 2014

Ok, so I have to make a program that tells the user to type a sentence and at the end of the sentence a "." must be put to end the program. If a "." period is not entered, it must re-prompt the user to enter a period. On top of all this, the program has to count the number of letters in the sentence. I cant seem to get the while loop working and I cant find anywhere how to make a counter count the number of letters.

import java.io.*;
class Sentence
//The purpose of this program is to

[Code]....

View Replies View Related

How To Get 1st Letter Of Input (String) And Compare It To Single Letter Before Insert To DB

Apr 15, 2014

Example : I have code and name but my code must start with the first letter of the inputed name if the 2 input is match it will be inserted into database

code = "A"001
name ="Angela"
= success this will inserted into database

else

code ="B"002
name="Angela"
=failed this will not inserted into database

else

code="A"003
name="Andy"
=success still accepts the input cause they have diff code number

What I am thinking on this was compare the code the name? if == it will be inserted but how do i get the 1st letter of the input name?

View Replies View Related

Program That Counts How Many Times A Letter Is Written

Sep 29, 2014

I can't get my code to print it like it's on the picture.

import javax.swing.JOptionPane;
import java.util.*;
public class BokstavTeller
{
public static void main( String[] args ) {
String input = JOptionPane.showInputDialog(

[Code] .....

View Replies View Related

Recursive Program To Change Two Four Letter Words Into Each Other?

Oct 28, 2014

SO for my project, we have to create a program where we input two four letter words, and using a list of words our teacher provided us and only changing one letter at a time, make the words match.For example, you input BALD and CALL and it would output BALD BALL CALLWe have to use recursion to do this, and I'm totally lost as to where to even begin.

View Replies View Related

How To Check String For Exactly 2 Capital Letters And 1 Space

Jul 23, 2014

I started using Java a couple of days ago, If you haven't guessed I want to see if the user is typing a full name or not, but I'm actually not too concerned with any more complexity than I mentioned in the title. It's ok if an input like "GLba b" comes out positive.

View Replies View Related

Java Program That Converts Number Grades To Letter?

Aug 3, 2014

I wrote a java application that coverts number grades to letter grades. Here is what it looks like:

/java application to That corresponds the letter grade with the number grade
import java.util.Scanner; //program uses the class scanner
public class gradescore{

[Code]....

View Replies View Related

Java Hangman Program - Replace Correct Letter With The Blanks

Apr 28, 2014

How to replace correct letter with the blanks in the program. Last method in program used to print correct letters.

import java.util.*;
import java.io.*;
public class Hangman {
public static Scanner keyboard;
public static final int MAXSIZE = 15000;
public static final int NUM_GUESS = 8;
public static final int WORD_LENGTH = 20;

[Code] ....

View Replies View Related

Write A Program That Translates A Number Between 0 And 4 Into Closest Letter Grade

Oct 8, 2014

Write a program that translates a number between 0 and 4 into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B. Break ties in favor of the better grade; for example 2.85 should be a B. Use a class Grade with a method getNumericGrade. why when I type .3 it tells me "Exception in thread "main" java.util.InputMismatchException" Or if there is an easier way to do this.

import java.util.Scanner;
public class Grades {
public static void main(String [] args) {
System.out.println("Enter a number between 0 and 4");
Scanner input = new Scanner(System.in);

[code]....

View Replies View Related

Program To Convert Temperature

Apr 24, 2014

Write a program that will provide temperature conversions between degrees Fahrenheit and degrees Celsius. Provide a method that will take an argument representing a temperature in Fahrenheit degrees and return the equivalent temperature in degrees Celsius. Also provide a method that will take an argument representing a temperature in degrees Celsius and return the equivalent temperature in degrees Fahrenheit. Conversion formulas are as follows: F = 9./5. * C + 32, C = 5./9. * ( F - 32 ), where F = Fahrenheit temperature and C = Celsius temperature. You must prompt for input using the Input class methods that are provided as a download for this unit.

I have two questions, 1st is why won't I get an output from my program when I run it? 2nd is how do I prompt for input using the Input class methods downloaded? The downloaded files are in .class form, and won't show any output when I run them.My code is:

import java.util.*;
public class temp
{
public static void main ( String [] args )
{
Scanner in = new Scanner(System.in);

[code]...

View Replies View Related

Program To Convert Binary To Decimal

Oct 13, 2014

I'm working on creating the Binary to Decimal program . hat is wrong with this part of my code. Why does it not take you into the loop.

import java.util.Scanner;
public class question5 {
public static void main(String[] args) {
System.out.println("Enter a Binary number. "); // collect
Scanner keyb = new Scanner(System.in); //

[Code] ....

View Replies View Related

GUI Program - Convert Input Name To Number

Mar 12, 2015

A GUI program that allows user to enter their name and the program will convert it in number using array.

For example if i input "EUNISE" the output should be 521149195

Because the letter equivalent of

a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
g = 7
h = 8
i = 9
j = 10
k = 11
l = 12
m = 13
n= 14
o = 15
p = 16
q = 17
r= 18
s = 19
t = 20
u = 21
v = 22
w = 23
x = 24
y = 25
z = 26

View Replies View Related

Program To Convert Utf-8 To Cp1251 Format

Apr 11, 2014

I am trying to covert utf-8 encoding into CP1251 encoding. But i am getting null pointer exception.
 
package ProcessDefinition;
import java.util.*;
import java.io.*;
import java.lang.String;
public class Process

[Code] .....

View Replies View Related

Trying To Count All The Vowels In A String

Feb 13, 2015

I am currently trying to count and display all the vowels in a set of given strings and can't seem to figure out what to do. I was able to print the line with the most vowels, but i also need to display them. The code is listed below and the given output.

public class Strings
{
public static void main(String[] args) {
String sentence = "I am currently studing Computer Science."
+ "My name is whatever and I am orginaially from the state of Virginia."
+ "I recenetly separated from the Air Force where I served on the Presidental Honor Guard.";

[Code] ....

The output that i am getting is:

I am currently studying Computer Science .
My name is whatever and I am originally from the state of Virginia.
I recently separated from the Air Force where I served on the Presidential Honor Guard.

The line with most vowels is:

I recently separated from the Air Force where I served on the Presidential Honor Guard.

View Replies View Related

Program Converting Fahrenheit To Celsius Using For Loop (will Not Convert)

Sep 13, 2014

I am trying to write a program converting Fahrenheit to Celsius using a for loop. I get it to run and Fahrenheit goes to a hundred. My issue is that the Celsius just says 100 down the column and is not converting. I have tried messing with it, and can not figure what is wrong with it.

import java.util.Scanner;
public class Controlstatement {
public static void main(String[] args) {
double F = 1.0;
double Celcius = 100;
System.out.printf("%s%20s", "Farenheit", "Celcius" );
for (int Farenheit = 0; Farenheit <= 100; Farenheit++) {
F = Celcius * (Farenheit - 32 * 5.0/9.0);
System.out.printf("%4d%,20.2f", Farenheit, Celcius);
}
}
}

The output looks like this all the way to 100:

Farenheit Celcius
0 100.00
1 100.00
2 100.00
3 100.00

View Replies View Related

Translator Program That Will Convert English To Custom Binary

Aug 23, 2014

I am trying to make a translator program that will convert english to my custom binary. It works going from english to binary, but not going from binary to english.

import java.util.Scanner;
public class Translator
{
public static void main ( String [] args ) {
Scanner input = new Scanner( System.in );
System.out.print( "Would you like to convert English to Binary (yes or no)? " );
String answer = input.nextLine();

[Code] .....

View Replies View Related

Making A Program That Could Convert Metric Units Into American System

Aug 31, 2014

I just started programming yesterday, and I have been making little programs to learn some algorithms and the syntax of java. I tried making a program that could convert metric units into the American system. Whenever I try to compile the code, it shows up as an "incompatible type" error. I know this is probably a very obvious answer to most of you, but I can't figure it out.

import java.util.Scanner;
public class MetricToAmerican
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("fWhat measurement would you like to convert into US system?
celsius, meter, or kilogram ");

[code]....

View Replies View Related

Write GUI Program To Convert All Lowercase Letters In String To Uppercase?

Mar 21, 2015

Write a GUI program to convert all lowercase letters in a string to uppercase letters, and vice versa. For example, Alb34eRt will be converted to aLB34ErT.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved