Homework 1
Instructions to submit to https://autolab.cs.jmu.edu from off-campus via sslvpn
Objectives
- Display output with print, println, and escape chars.
- Identify and correct errors from a Checkstyle audit.
Exercise 1.1 Hello World
Write a program named HelloWorld.java that displays the message Hello, World!
exactly as shown. The point of this exercise is to set up your development environment and become familiar with Autolab. To get full credit, your submission must also pass Checkstyle rules.
Exercise 1.2 Fight Song
Write a program named FightSong.java that prints the JMU Fight Song lyrics:
Madison, James Madison, We are the Dukes of JMU Madison, James Madison, The fighting Dukes of JMU Fight for Glory-- Honors Won Brighten the Lights of Madison Madison, James Madison, Show your Colors Proud and True We are the Dukes of JMU
Each line should be a separate println statement in the code. Your output must match the above text exactly, character for character.
Exercise 1.3 Alan Turing
Write a program named AlanTuring.java that outputs the following quote from one of the most famous computer scientists (it is also referenced in the Movie The Imitation Game
"Sometimes it is the people no one can imagine anything of who do the things no one can imagine." - Alan Turing
The whitespace before the hyphen must be a single tab character. Most environments, including web browsers, display tabs as eight spaces. Use appropriate escape sequences so that the output matches exactly.
Exercise 1.4 ASCII Art
Write a program named Flower.java that draws the following ASCII art exactly as shown. Notice that each line begins with a space, and there are no extra spaces at the end of each line.
/\ \ \/ / / | \ | ------ / \ | | \ / ------
Exercise 1.5 Long Lines
Write a program named LongLines.java that displays the following lyrics from the beginning of "The Body Electric" by Rush (see the following about Rush.
The Body Electric -- Rush ------------------------- "One humanoid escapee one android on the run, seeking freedom beneath the lonely desert sun" "Trying to change its program trying to change the mode, crack the code, images conflicting into data overload"
Note that each quote ends with a newline character, and there are no line breaks in the middle of a quote. The point of this exercise is to learn how to format your source code without exceeding 80 characters per line.
Your solution must NOT use the + operator. Autolab will reject any submission that has a "+" character anywhere in the file.