• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

transform to lower case

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

}



Hello I am trying to write a program where the user input transform to lower case but I am having problems to return two values as lowercase method takes one input.
**also I know I can do all this in the main method, but I want to try to do it in two separate methods**
Thank you
 
Rancher
Posts: 3968
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

having problems to return two values as lowercase method takes one input.


Please explain what you want to do.  
 
jack miles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
       public class totallacation
       {
         public static void main(String[] args)
         {    
   //scanner
           java.util.Scanner reader = new java.util.Scanner(System.in);
           
       
              System.out.println("What country will you be visiting?");
            String location = reader.nextLine();
          char country = location.charAt(0);
         
             System.out.println("Do you have a valid a Passport?");
            String verify = reader.nextLine();
          char passport = verify.charAt(0);
   
            System.out.println("Do you enjoy travelling?");
            String place = reader.nextLine();
          char travel = place.charAt(0);
             
            // I want help to do this part  
           passport =  toLowerCase(lowerCase);
           country = toLowerCase(lowerCase);
           travel = toLowerCase(lowerCase);
           
         }
           
            public static char toLowerCase(char lowerCase){
             if (lowerCase >= 'A' && lowerCase <= 'Z')
               {
                 lowerCase = (char) (lowerCase + 32);
               }
              return (lowerCase);  
            }
       }

Hi, so my program ask the user this following questions in the main method and the user answers them with one letter, after that char toLowerCase method return the lower case of the user input. I am having trouble to return multiple input to the main method. Thank you
 
Norm Radder
Rancher
Posts: 3968
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 I am having trouble to return multiple input to the main method.


Can you call the method more than one time to get multiple values returned?

The following code passes the same value to the method and will get the same value returned each time. To get different values returned, the code needs to pass different values to the method.



Please remember to wrap all posted code in code tags to preserve formatting.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic