It's time to put your skills to the test. This problem set focuses on printing text to the console, as well as identifying and correcting compilation and runtime errors in the supplied program code.
To get started, create a GitHub repository to store your code. When you're finished, clone my skeleton to get all of the starter code and instructions. Setup a remote to push your code to your repository instead of mine.
- Login to your GitHub account and create a new repository named
pset-0
. - In the terminal, navigate to your
APCSA
directory on theDesktop
.
$ cd ~/Desktop/APCSA
- Clone my skeleton repository into a directory named
pset-0
.
$ git clone git@github.com:ap-java-ucvts/pset-0-skeleton.git pset-0
- Change into your newly created
pset-0
directory.
$ cd pset-0
- Overwrite the remote, which originally points at my skeleton repository.
$ git remote rename origin upstream
- Add a new remote that points at your
pset-0
repository. ReplaceYOUR-USERNAME
with your actual username.
$ git remote add origin git@github.com:YOUR-USERNAME/pset-0.git
- Open up the
ProblemSet0.java
file in the text editor of your choice.
Pretty ugly, right? Just wait until you try to compile it. For now, you haven't yet learned enough to properly format your program and its code. Later, after you have, you'll be able to avoid code that looks as cluttered as this does.
The specifications for each exercise are outlined below. I've written most of the code for you, but unfortunately, it is riddled with mistakes. It's your job to fix the errors I've made, so that the code meets the requirements set forth in this section (as well as the Deliverables section).
The console output for these exercises relies on consistent tab sizing. I used a width of 4 spaces for my tabs while writing the starter code, so you'll need to do the same when debugging it. Use the following command to instruct the terminal to display tab stops at 4 spaces.
tabs -4
Work through these exercises on your own. Experiment, make mistakes, ask questions, and fix your mistakes. It's the only way to get good at programming.
Print a message to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation.
Print APCS in block letters to the console.
- Insert one line feed above and below the desired output.
- Letters must have a height of seven characters, with one space between each letter.
- Use seven print statements.
- Do not use
String
concatenation.
Print a quoted message to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation.
Print a face to the console.
- Insert one line feed above and below the desired output.
- Use six print statements.
- Do not use
String
concatenation.
Print a to-do list to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation. - Do not print more than one consecutive space.
Print a square of text to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation. - Do not print more than one consecutive space.
Print a countdown to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation. - Do not print more than one consecutive space.
Print three diamonds to the console.
- Insert one line feed above and below the desired output.
- Use six print statements.
- Do not use
String
concatenation.
Print an encouraging message to the console.
- Insert one line feed above and below the desired output.
- Use one print statement.
- Do not use
String
concatenation.
Print a plus sign to the console.
- Insert one line feed above and below the desired output.
- Use three print statements.
- Do not use
String
concatenation. - Do not print any spaces.
After fixing each of the compilation and runtime errors, your code should produce the following output.
Please read very carefully. Historically, most students lose points on problem sets for simply failing to read the instructions and requirements.
- September 15, 2019, at 11:59pm.
If you submit your problem set at midnight (i.e., September 16, 2019, at 12:00am), it is considered late!
- Your code must compile. Code that fails to meet this minimum requirement will not be accepted.
- There must be at least 5 unique commits to your repository.
- Your code must meet each requirement outlined in the Exercises and Deliverables sections.
- Your code must adhere to the course style guidelines.
Happy coding!