CS251L - Fall 2012

Intermediate Programming

Section 002


Jan Monterrubio

Email: janmonterrubio@gmail.com

Office: FEC 3rd Floor Lounge or (FEC 309)

Office Hours:

Wednesday 3 - 5 PM

Friday 2 - 4 PM

Full TA and Tutor Schedule

If these times don't work email me and I'll make sure you get the help you need.


Syntax and Word Play

August 28th, 2012

Some sort of Introduction

Some of you are new to this java thing, others are not. This week's lab will help you get (re)familiarized with some of Java's quirky syntax. This will be one of the easier labs and there is a provided skeleton file if you wish to use that. You are NOT REQUIRED to use the skeleton file, however if you have no idea how to start, a good point to start would be within a skeleton file (after reading the lab requirements of course). Labs may have a "ridonkulus" background story, this is normal and will probably happen with every lab. Mostly puns on things on the real world, and sometimes completely made up things in order to have a sort of back story to why the lab exists other than for just a grade.

Formal Introduction

Hopefully before now you have seen or heard the word String somewhere within the concept of programming. Today we will be playing with some Strings, manipulating them and playing with their inner components, characters. If this is the first time you are working with Strings, a good place to look into would be Java's String API

Requirements

  • SIGN UP FOR THE CLASS mailing list
  • Turn in a file named "WordPlay.java"
  • WordPlay must be able to read a string from the command line, this is what (String[] args) is used for. If No argument is passed to the command line or more than one argument is passed, your program must exit (ie System.exit(#) ) with a NON-ZERO value
  • WordPlay must have the following operations:
  • You must have ONE method (or function) per operation.
  • Your Main Method must show all three operations being used with the same String
  • Have comments on your method, consider wether they RETURN something or not
  • Grading

  • 75% Meets Requirements
  • 25% Code Style
  • 10% Extra Credit: Only allow ALPHABETIC Chars (a-z and A-Z). And exits with a status wth NON-ZERO value if the String containts non alphabetic characters
  • Tips

  • READ THE WHOLE LAB BEFORE STARTING
  • Look at the skeleton file!
  • For the stringInvertCase operation think of characters in their ASCII value
  • Try to use enhanced-for loops (a google search might enlighten you more)
  • If you're comfortable with reading the API and want to try something new, try using a StringBuilder
  • Another good class to look at would be Character within the API
  • ASK QUESTIONS IF YOU NEED SOME HELP
  • Submissions

    For this week's lab, you must do two things:
  • Send your file "WordPlay.java" to the email cs251f12ATgmailDOTcom . The Subject of your file must be Formated as such NAME-LASTNAME-SECTION DateOfLab. IE, my submission would be Jan-Monterrubio-002 8/28
  • turn in a PRINTED version of your lab (you will receive comments about style). The printed version must be turned in AT THE START of your next lab
  • Solutions

    JM's Solution