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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java String Character Data Entry Program

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have an assignment in my computer science course and i can't figure out how to get this code to work to these guide line

this is the code


and these are the guide lines i am suppose to follow

Write a Java program that asks the user to enter characters, one at a time, from the command line. The program should end when the period (".") character is entered and the number of case changes that occurred should be displayed. As each character is entered, the program
o should change each lower case character to upper case after it is entered.
o should change each upper case character to lower case after it is entered.
o should output the resulting change to the monitor after each character is input.
o should not make any changes to other characters such as @ or $).
o should instruct the user to enter the period (.) character to end the program.


Help would be awesome because i am really stumped by this one

the most trouble i am having is finding a way to have the program reconize that a period has been entered and adding the strings entered together.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Ben Peer wrote:the most trouble i am having is finding a way to have the program reconize that a period has been entered



You are checking each time round the loop whether mix ends with a '.', but you never change the value of mix in the loop, so it will never end with '.' (unless the first character you enter is a '.').
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Conversation continued in this thread
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Locking to avoid cross-talk.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Opened again to point out that it can cause no end of confusion to have multiple threads, either on the same website or on different websites.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic