Start Eclipse. If you find an icon on the desktop labeled Eclipse, you can double click that. If not, select Start/all programs/Eclipse/Eclipse.
Begin reading the tutorial. You can start the tutorial by clicking on the tutorial button in the right hand pane.
Create a project, as outlined in the tutorial. Store the project in a subfolder in your My Documents folder. It should be a new Java project. Write a program that just prints "Hello world" as shown. Run it.
Before starting on the assignment, read the entire rest of this page.
Create a new Java project for this assignment. This is exercise 7 on page 126 of the text. (You do not need the text. Just read below.)
Write a Java program that asks a user to enter the first name of a friend or relative, a favorite color, a favorite food, and a favorite animal. The program should then print the following two lines, with the users input used to replace the parts in red.
I had a dream that Name ate a Color Animal and said it tasted like Food!For example, if the user entered Jake for the person's name, blue for the color, hamburger for the food and dog for the animal, then the output would be
I had a dream that Jake ate a blue dog and said it tasted like hamburger!Don't forget the exclamation mark at the end. Read the parts of the input one line at at time, with a separate prompt for each one. The prompts should be clear and meaningful.
To print a line, use
System.out.println(text);where text is the string that you want to print. You can combine strings using the + operator.
To read, begin by creating an object that will do the reading for you. Use
InputStreamReader reader = new InputStreamReader(System.in); BufferedReader keyboard = new BufferedReader(reader);to set up the object, called keyboard. Now line
String line1 = keyboard.readLine();will read one line and store it into variable line1. You will need to read four lines.
In order to use the input and output features, you should add line
import java.io.*;to your program, before the main program. Then make the heading of your main program be as follows.
public static void main(String[] args) throws IOExceptionIf you do not include throws IOException, then the Java compiler will complain about an uncaught exception.
Print your program, and turn in the printed version. Be sure that your name, the course (CSCI 2310), the assignment number and the date are in the program in a comment. Remove the comment that Eclipse puts in your program.