Lab 1: Simple Output, Loops, and Conditionals
Due: 10pm Thursday February 1
Purpose: This assignment will familiarize you with basic output, simple conditionals, and iterated loops. You should only use simple conditionals, iterated loops, and the output statements we have covered in class (i.e., don't define your own methods yet).
El Condor Pasa
I'd rather be a sparrow
than a snail.
Yes I would.
If I could,
I surely would.
I'd rather be a hammer than a
nail.
Yes I would.
If I could,
I surely would.
I'd rather be a forest than a
street.
Yes I would.
If I could,
I surely would.
Notice that the above song has a repetitive structure. A
simple program would write a println statement for every line of the
song in order. However, the graders will not give this solution full
credit. Your full credit solution will take advantage of the repetition
in the song, and each unique line will only appear once. For
example, your program should produce
Yes I would.several times, but it should appear in the text of your program only once. You should use loops and conditionals to effect this requirement, but not methods, since we have not yet covered them in class.
Here is a template for your lab. Remember to always include your names, slip days, and a comment at the top of your file.
/**
* @author name 1:
* slip days used on this assignment: ??/4
* total slip days used: ??/6
*
* @author name 2:
* slip days used on this assignment: ??/4
* total slip days used: ??/6
*
* @version* * Describe what this program does. * * */ public class Song { public static void main (String [] args) { } }
Submission and Grading:
Submit your version of Song.java using the turnin program. If you need help goto turnin program help .
Your output should exactly match output.txt
Half your score will come from "external correctness" which means the output of the program exactly matches the specification. The remaining score comes from "internal correctness" which means you used the specified Java constructs correctly, you captured the redundancy and structure correctly, you commented the header and code appropriately, and you followed the basic Java style guidelines.
If you are submitting without a partner, please include your initial partner and the email correspondence with the instructor or with the TA in your header.