Please fill out this short survey. Your answers will help your instructor get to know you and learn what you hope to get out of this course. This will help me modify the course to best fit your interests.
Write a program, Fortune.java
, which prints a fortune like the ones typically found in fortune cookies. Use the program as a starting point.
1. // Name:
2. // Date:
3. // Description: Print a fortune to the console
4.
5. public class Fortune {
6.
7. public static void main(String[] args) {
8. System.out.println("Hello World!"); // todo: your message here
9. }
10. }
You can download Fortune.java
from the course website using the following command:
wget https://cs.brynmawr.edu/cs113//website/hws/hw00/Fortune.java
Below is an example of compiling and running the program in the command line:
$ javac Fortune.java
$ java Fortune
A journey of a thousand miles begins with a single step.
Dont forget: make sure to fill in the header in Fortune.java
.
Programming is very similar to writing. A first draft is always messy. Its no
different when programming, you’ll make plenty of mistakes when first writing
any program. A nice thing about programming is that the compiler is your friend who will tell you the mistakes that you’ve made.
First delete the binary file (Fortune.class
) that was created when you compiled Fortune.java
.
In this part of the assignment, we are going to make some mistakes on purpose. For each of the following changes 1) copy the error message you see when compiling the program and 2) a simple explanation of what you think that message might mean. If the program compiles, try running it.
Save your answers in a new file called ERRORS.txt
. After making each edit listed below, revert the edit so that the file is the same as when you ended the last part of this assignment.
;
at the end of line 8.Fortune
in line 5 to fortune
.main
to blah
in line 7.}
in line 10.}
in line 9.Read Computer Science: Not about Computers, Not Science.
In a new file called HW00_READING.txt
answer the following questions:
Submit the following files to the assignment called HW00
on Gradescope:
Fortune.java
ERRORS.txt
HW00_READING.txt
Make sure to name these files exactly what we specify here. Otherwise, our autograders might not work and we might have to take points off.