p2.COP2551.Spring2010

p2.COP2551.Spring2010 - Program #2 Introduction to OOP with...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Program #2 Introduction to OOP with Java COP 2551 – Spring 2010 Strings Objectives: Gain more experience with interactive programming (prompts and replies) Gaining experience in writing a Java program from scratch To gain experience with Strings To gain experience with validation of inputs To gain experience with loops and conditional expressions. Functionality: This is quite similar to a program in your textbook with a few enhancements I added… Design and implement an application that prints the verses of the song, The Twelve Days of Christmas,” in which each verse adds one line. The familiar first two verses of the song are: On the 1 st day of Christmas my true love gave to me A partridge in a pear tree On the 2 nd day of Christmas my true love gave to me Two turtle doves, and A partridge in a pear tree You will need to code these twelve Strings into your program as String objects, since at this time we have not yet covered file input / output. (However, if you want a significant bonus, say 30 points, you may try to create a file and read these in one line at a time. You would likely need to put them into an array of Strings…) Use a switch statement in a loop to control which lines get printed. Hint : Order the cases carefully and avoid the break statement. Use a separate switch statement to put the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/26/2011 for the course COP 2551 taught by Professor Roggio,r during the Summer '08 term at UNF.

Page1 / 3

p2.COP2551.Spring2010 - Program #2 Introduction to OOP with...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online