DOC PREVIEW
UNF COP 2551 - Study Notes

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Program #2Introduction to OOP with JavaCOP 2551 – Fall 2010 StringsObjectives:- 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 1st day of Christmas my true love gave to meA partridge in a pear treeOn the 2nd day of Christmas my true love gave to meTwo turtle doves, andA partridge in a pear treeYou will need to code these twelve Strings into your program as String objects. Use a switch statement in a loop to control which lines get printed. Hint: Order the cases carefully. Use a separate switch statement to put the appropriate suffix on the day number (1st, 2nd, 3rd, etc.). The final verse of the song involves all 12 days as follows:On the 12th day of Christmas, my true love gave to meTwelve drummers drumming,Eleven pipers piping,Ten lords a leaping,Nine ladies dancing,Eight maids a milking,Seven swans a swimming, Six geese a laying,Five golden rings,Four calling birds,Three French hens,Two turtle doves, andA partridge in a pear tree.Now, you are to first prompt the user for his/her name and their classification (numeric) (1 = Freshman, 2 = Sophomore, …, 5 Graduate Student). You are to then print out his/her name and classification as follows: This output is produced by Joe Schmuck (please use your name), who is a junior at UNF.Note, JoeSchmuck is a String input and requires no conversion. ‘3’ is also a character that is inputted, but your Scanner object will take care of this for you.Once this line is printed on the screen, you are to skip two lines (two blank lines). Then you are to prompt the user (me, again) for a number between 1 and 12. Bad inputs: If the number the user submits does not lie between 1 and 12, you are to prompt the user to try again, such as providing the message, “Try Again. Enter a number between 1 and 12 inclusive and press Enter” and allow the misguided person (probably me again!) to re-enter another number. (This will require a loop). If the user fails to submit a number between 1 and 12 with three tries (total, including the first attempt and two repeats) then you are to display a message, “Get a Life! Program Terminated” and terminate your program. (Be certain to test this option. I will.)Good inputs: Now, once a proper integer is submitted to your program, this number is tobe treated by your program as the starting verse of the Christmas song to be printed. You should then skip two lines (means have one blank line) and print a ‘header’ line that says:Given an input of (enter the number), the following verses are now sung: (skip to next line) <follow this text with the appropriate number of verses – one verse per line>Again, verses displayed are to proceed downward from the number inputted.Using this number, say 8, print that verse and remaining verses down to and including the first verse. The starting verse is the high verse number. Given an 11, you will display verse 11 down to and including verse 1. Submission (due Wednesday, October 6th by the start of class) Late turn ins will be accepted until 4:30 11th October with appropriate creditreduction. As will be explained in class, you will need to supply comments at the beginning of your source code using Javadoc and also internal documentation where appropriate. Be certain to tag (provide a comment for) closing braces on methods and classes (scope terminators) . Turn your assignment in using Blackboard as you have done. Your project should be likeproject2jschmuckAs usual, this programming assignment will be accepted after the due date but with heavypenalty. If you have any questions, DO NOT WAIT UNTIL IT IS TOO LATE! This isa fun assignment. Enjoy the learning process! Programming Guidelines:- Your programming style should adhere to the design guidelines in the Appendicesof your textbook and the recommendations made in class.- Be sure you add a comment to the close brace of each method and each class, as mentioned in class- Javadoc – will be discussed in class. Be careful. There are several ways to produce it. I want a very specific approach to be used that will generate the .html files that I’m looking for.- In your source program, be sure to include your name in the information in your program header


View Full Document

UNF COP 2551 - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?