CSCI1302 Project 1-Linux and Java warm-up Solved

30.00 $

Category:

Description

Rate this product

Project 1: Linux and Java warm-up

In this project, you will create, compile and run a simple Java program on our Linux server.

Project description:

  1. Create a directory called cs1302 in your home directory on odin. You will use this directory to implement this and future projects in this course. In the cs1302 directory, create a sub-directory called Project1. You should place your Java program (described below) in this directory.
  2. Design and implement a Java class called User, in which the main method prints out on standard output a single line of text of the form:

    I am your_username on operating_system_type
    For example, for user smith, the output of your program should be exactly like this:

            I am smith on Linux
    

    Your program must not output anything else.

    You should use either emacs or vi (both are available on odin) to create the source code for your class. Also, you should use the javac and java commands to compile and run your program, respectively.

  3. The part of the required output line after “I am ” should be created using the values returned from calls to the static methods getUserName() and getOSName(), provided by the UserIdentifier class. These methods are declared as:
            public static String getUserName()
    

    public static String getOSName()
    Your program should simply print the string ”I am ” concatenated with the values returned by

    the getUserName and getOSName methods with “ on “ in between.

  4. The UserIdentifier class is included in a jar file, called ident.jar, which is available in directory /home/myid/kkochut/classes on odin (the directory and the jar file are publicly readable). You will have to define the CLASSPATH environment variable or use an appropriate option when compiling and running your program, in order to include access to ident.jar. If you prefer, you can copy this jar file into your own file space.

Submit your Project1 directory to csci-1302a on odin. You must use the submit command to submit your work, as shown below:

     $ submit Project1 csci-1302a

Important: You should execute the above submit command while being in the parent directory of Project1, i.e., in cs1302 (the current working directory must be cs1302) or use the absolute path name to Project1.

Things to note:

• Follow good coding style (proper variable names, indentation, etc). • Include comments in your program.

  • Project1-bce8wf.zip