CSCE 2014 - Laboratory Assignment 1

    The purpose of this lab is to get students started using the CSCE computers and the C++ programming environment we will be using this semester. In particular, we will start with an introduction to Linux and then we will start working with the NetBeans programming environment. Since this will be the first time using this software for most of you, our advice is to be patient and ask your lab instructor and your classmates questions when you are stuck.

  1. Getting Started
  2. Introduction to Linux
  3. Linux is a member of the Unix operating system family that was originally written by Linus Torvalds in 1991. It is widely distributed on both desktops and servers, and used on over 90% of the top 500 supercomputers in the world. For more information, see the Linux wiki page.

    A number of useful Linux commands are listed and explained below. To find out more about any Linux command, use the online manual pages provided by the system. These pages typically show the different options available, examples and list any known bugs. The following list contains some common linux commands we will be working with today:

  4. Practice with Linux Commands
  5. In this section, students will get some practice with the Linux commands listed above to create and manage folders for labs and homework in this class.

    In order to display the manual pages for these commands, you can use the "man" command.


    Try this for two or three Linux commands above to see what these pages look like.

    Create a directory called csce2014 from inside your home directory.

    	cd ~
    	mkdir csce2014

    Create the directories called lab1, lab2, and tmp from inside csce2014.

    	cd csce2014
    	mkdir lab1
    	mkdir lab2
    	mkdir tmp

    From your home directory, list all the sub-directories inside csce2014 with their details.

    	cd ~
    	ls -al csce2014

    Copy and paste the output results of the "ls" command below.

    Use "man" to display the manual pages of the "rm" command. This time, instead of displaying the page to the screen, you can save it to a text file inside the tmp directory created above.

    	cd ~
    	man rm > csce2014/tmp/rm_manual.txt

    The "more" command will let you look at rm_manual.txt file one page at a time.

    	more csce2014/tmp/rm_manual.txt

    Make a copy of the rm_manual.txt file in the lab1 directory called new_manual.txt.

    	cd ~/csce2014
    	cp -i tmp/rm_manual.txt lab1/new_manual.txt

    Execute the "cp" command again. What happened?

    Move the rm_manual.txt file from the tmp directory to the lab1 directory.

    	mv -i tmp/rm_manual.txt lab1/

    Delete the empty directory tmp.

    	rmdir tmp

    From csce2014, use "ls" to list the details of subdirectories as well as their contents.

    	cd ~/csce2014
    	ls -Ral

    Copy and paste the output results of the "ls" command below.

  6. Configure your Linux Environment
  7. When you login to Linux, the system reads your ".bashrc" file to load your personalized settings. This file lets you create your own "alias" for common commands, and set up your own search path when you have collected/created a number of programs.

    Edit your .bashrc file to include some command aliases using gedit or your favorite editor. Copy the following lines into the bottom of file. This will save you time typing -i in the future and prevent you from deleting files by accident.

    	alias cp='cp -i'
    	alias mv='mv -i'
    	alias rm='rm -i'

  8. Introduction to NetBeans
  9. NetBeans is a popular integrated development environment (IDE) for writing and debugging programs in Java, C++, and other languages. Most IDEs have editors that are "syntax aware" and will help with indenting. They also have interfaces that let you click on compiler errors/warnings and jump directly to the incorrect code. There are also several features that assist in tracing and debugging programs. On the downside, many IDEs have dozens of menu items, so it takes a while to learn how to use them effectively.

    For this lab, go through the following steps to create and compile a simple program.

    Congratulations, you have now created your first C++ program using NetBeans! The next step is to edit the source file and compile and run the program.

    Copy and paste your program output into the text box below.

  10. Creating C++ Classes in NetBeans
  11. In this section, we will be adding a C++ class called "Student" to the "hello" project. There are several ways to do this, but we will show how NetBeans can be used to create skeleton code for the class (and save you lots of typing). `

    Copy and paste your final program output into the text box below.

  12. Submit Work
  13. This lab assignment will be submitted electronically to the TAs once you fill in the fields below and click on the "submit" button. You do NOT need to print a copy of this document to hand in.

    Your full name:
    Your uaid number: