P3.Fall2005

P3.Fall2005 - Program #3 Introduction to OOP with Java COP...

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

View Full Document Right Arrow Icon
Program #3 Introduction to OOP with Java COP 2551_042 Fall 2005 Objectives: Gain experience using several arithmetic operators Gain experience with interactive programming (prompts and replies) Gain exposure to BufferedReader class and parseInt and parsetFloat methods Gain experience to importing packages and classes Gaining experience in writing a Java program from scratch To gain experience with Command-line inputs To gain experience with loops and conditional expressions. Functionality: This is quite similar to program 5.17 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 once line. The last 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 Use a switch statement in a look to control which lines get printed. Hint: Order the cases carefully and avoid the break statement. Use a separate switch statement to put the appropriate suffix on the day number (1 st , 2 nd , 3 rd , etc.). The final verse of the song involves all 12 days as follows: On the 12 th day of Christmas, my true love gave to me Twelve drummers drumming, Eleven pipers piping, Ten lords a leaping, Nine ladies dancing,
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.

Page1 / 3

P3.Fall2005 - Program #3 Introduction to OOP with Java COP...

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