4 Replies - 1066 Views - Last Post: 02 October 2007 - 07:26 AM Rate Topic: -----

#1 YellowShadow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-October 07

Can u make this java code ?

Post icon  Posted 01 October 2007 - 04:53 PM

hi everyone

this my first time here

it's cool site and i hope it will help me in my major

i'm beginner in java so plz help me to solve it

Quote

Q3. Design and implement a program that takes any uppercase string and convert it to lowercase case string with capitalized initials, the string contains exactly 3 words.

Example execution:
Input an UPPERCASE string
JAVA IS FUN
the modified string is: Java is Fun
Hint : Use indexOf() and substring() methods.


Q4. Design and implement a program that takes a 4 words’ string from the user then reverse its words.

Example execution:
Input a string to reverse
one two three four
the reverse is: four three two one
Hint : try it using three words first.


Is This A Good Question/Topic? 0
  • +

Replies To: Can u make this java code ?

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Can u make this java code ?

Posted 01 October 2007 - 04:57 PM

HI YellowShadow, welcome ! :)

First I recommend you read the forum rules. You should show us the code you've written so far so that we could help. I also suggest you take a look at the code snippets and the tutorials here as well as sun's tutorials.
Was This Post Helpful? 0
  • +
  • -

#3 YellowShadow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-October 07

Re: Can u make this java code ?

Posted 01 October 2007 - 05:02 PM

thnx penny

this is my code but i cant complete
import java.util.Scanner;

public class Q3
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner (System.in);
		
		System.out.println("Input an UPPERCASE string");
		String a = input.nextInt ();				   // then i stopped i dont know what to do
	}
}
[edit] code tags PB

This post has been edited by PennyBoki: 02 October 2007 - 07:09 AM

Was This Post Helpful? 0
  • +
  • -

#4 Synth  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 29-August 07

Re: Can u make this java code ?

Posted 01 October 2007 - 05:50 PM

View PostYellowShadow, on 1 Oct, 2007 - 05:02 PM, said:

thnx penny

this is my code but i cant complete

import java.util.Scanner;

public class Q3
{
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);

System.out.println("Input an UPPERCASE string");
String a = input.nextInt (); // then i stopped i dont know what to do
}
}


Yellow shadow you should put "[code ]" at the begining of your code and "[/code]" at the end minus the spaces and the quotes
anyways heres how you can change it to lowercase
//replace stringname with your variable for the input and itll make the string lowercase
//make it equal to another string so you can store the data after you convert it
stringname.toLowerCase()


Was This Post Helpful? 0
  • +
  • -

#5 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Can u make this java code ?

Posted 02 October 2007 - 07:26 AM

ok YellowShadow so Synth gave you a hint how to make them to lower case all of the chars. So here is an idea how to do the rest:

After you'll use the toLowerCase() function...
make the first char of the whole string always upper case, then find the first ' ' empty space and make to upper case the first letter after that, and so on and so forth until the end of the string.
Bu there is another way to do this using the hints of the assignment.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1