The purpose of this assignment is to introduce you to programming in Java and familiarize you with the mechanics of preparing and submitting assignments.


  1. Install our Java programming environment.  Install our novice-friendly Java programming environment on your computer by following these step-by-step instructions for Mac OS X, Windows, or Linux.

    As part of these instructions, you will write, compile, and execute the program HelloWorld.java.

    ~/Desktop/hello> javac-introcs HelloWorld.java
    ~/Desktop/hello> java-introcs HelloWorld
    Hello, World
    


  2. Command-line arguments. Write a program Greeting.java that takes a two greetings and two names as command-line arguments, and prints them as shown below .
    ~/Desktop/hello> javac-introcs Greeting.java
    ~/Desktop/hello> java-introcs Greeting Hi Hola Marcel Sebastian
    Hi Marcel, my name is Sebastian.
    Hola Sebastian, my name is Marcel.
    ~/Desktop/hello> java-introcs Greeting Ciao "Nǐ hǎo" Kellia Hagop
    Ciao Kellia, my name is Hagop.
    Nǐ hǎo Hagop, my name is Kellia.
    ~/Desktop/hello> java-introcs Greeting مرحبا Bonjour Vitus Nadine
    مرحبا Vitus, my name is Nadine.
    Bonjour Nadine, my name is Vitus.
    

    For greetings in a large number of languages, see HelloWorldMultilingual.java.


  3. Standard image. Write a program ShowHello.java that takes the name of an image file (that displays Hello World) and shows that image file using StdPicture.read() and StdPicture.show(). Recall, StdPicture.read() takes a string as an argument (such as "HelloWorld.png"), treats that string as the name of an image file (or a URL) and loads that image. StdPicture.show() then displays the image that was previously loaded.

    The greeting_images subdirectory of the project file contains a few images of Hello World written in different languages. Below are some sample executions:

    ~/Desktop/hello> javac-introcs ShowHello.java
    ~/Desktop/hello> java-introcs ShowHello greeting_images/English-Marcel.png
    
    Hello World in English
    
    ~/Desktop/hello> java-introcs ShowHello greeting_images/Arabic.png
    
    Hello World in Arabic
    

    Submit an image file named MyImage.png with "Hello, World!" written by you (in the language and/or style of your choice). If you authorize, we'll show it in lecture or precept! Also, try your hand at displaying images beyond greetings – you can write or draw something, take a picture, or download an image you like. Feel free to get creative!


    Submission. Submit the files HelloWorld.java, Greeting.java, ShowHello.java and MyImage.png. Also submit the file readme.txt and answer the questions.


    Grading.
    File Points
    HelloWorld.java 10
    Greeting.java 10
    ShowHello.java 10
    MyImage.png 5
    readme.txt 5
    Total 40

    This assignment was developed by Sebastian Caldas, Marcel Dall'Agnol and Kevin Wayne.
    Copyright © 2024.
    Credits.