Bookmark Topic Watch Topic
  • New Topic

CourseSplitter  RSS feed

 
kerwin john abrinica
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hey guys . need some help about this ..

My instructor gave me this Activity.

Normally a course is described as follow: ABC 123 : Course Description. Design and implement a Java program named CourseSpliter.java that contains a method that will split then print the 3 components of the following course description: ICS 102 : Introduction to Computing I as shown below:
Course Name: ICS
Course Number: 102
Course Description: Introduction to Computing I

After displaying the output ask the user if another input will be given.

Hint: Use the StringTokenizer class and its methods.

NOTE: Your program should work for any course description following the above format (i.e., ABC 123 : Course Description) NOT ONLY the given course description in the example.


and this is my work ..


Question : in the course description how can i put two or more words ?

if you have answer just wrote it down.

THANKS
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Report post to moderator
First off, please use code tags when posting code in your message, it improves readability.
Secondly, the use of StringTokenizer class is discouraged, instead you should use String's split method.

After splitting, you know that the course name is the first word, the course number is the second, so the rest of the words must form the description (thus, you can get the complete course description).

Cheers,
Claudiu
 
Saikat Roy Mahasay
Greenhorn
Posts: 10
Fedora Opera VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Dude, the code that you wrote, works very well for multi-word Course description. I am not sure if I understand what's your query?
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is exactly same query as this one. So lets continue the discussion there.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!