Friday, August 28, 2009

Lab 02 grades

I have just emailed each of you your grade for Lab 2. The grades are all out of 10 points. If you did not show up to the lab you received a 0, as you will every time you miss lab. Please keep that in mind. You will receive all the grades in this class via email. I used your username@mailbox.sc.edu email address. If you would like me to send your grades to a different address then email your TA (their email addresses are here) with the address you would like us to use.

Thursday, August 27, 2009

Eclipse vs Netbeans

In class about some comments about the relative merits and popularity of these IDEs, so I thought I'd try and get some data on it. Below is (possibly?) a measure of their relative popularities:

eclipse ide 
1.00
  
netbeans ide 
0.40
  

Section005: Lab canceled today!

Section 005: NO lab today (Aug. 27th 2:00 pm - 4:00pm) !!

Tuesday, August 25, 2009

Chapter 2 Lecture

Below is my screencast for Chapter 2 of the textbook where we cover variables and keyboard and screen I/0. Pay close attention to the different variable types, including int, double, and String (note: proper capitalization is important!) You should have read Chapter 2 and watched the screencast below, as well as practiced doing what I do in the video, by Tuesday, September 1.

CSCE 145: Chapter 2 from Jose Vidal on Vimeo.

Also, the slides from the textbook should help you review the material after you have read the book:

Lab 02

Question 9 on Textbook Page 117. Good luck. =)

Wednesday, August 19, 2009

Chapter 1 Lecture

Below is the video lecture that you must watch before coming to class on Tuesday August 25. Notice that to get the full HD resolution (1280 by 720) you have to watch the video in fullscreen mode, click on the fullscreen icon on the bottom right of the video to go to fullscreen. You should read Chapter 1 of the textbook before watching the video.

As you watch this videos, as well as all future videos I will show, make sure you stop it often and try by yourself to repeat what I did on the video. This is the only way to learn: by doing. No one can learn to program by simply watching a lecture.

CSCE 145: Chapter 1 from Jose Vidal on Vimeo.

If you have trouble installing eclipse or Java on your laptop, or getting the "Hello World" program to run please come to class on Tuesday (with your laptop, if needed) so we can fix it. You can also get from your fellow CSE students by visiting the ACM Student Chapter room in the second floor of Swearingen. They will be posting tutoring hours on their door.

I am also embedding the slides for this chapter below. No, I did not use these slides in my lecture and I do not recommend you read these instead of reading the book. They are only useful as reminders of what you have already read.

Lab 1

Use Netscape/Internet Explorer to get to the lab instructions. It is a good idea to set a bookmark at http://www.csce145.com

  1. The laboratory computer systems run the Microsoft Windows XP operating system. Because it is connected to a server in the College (running Windows Server), you have a login, password, and a "profile" that can follow you around to whatever computer you use within the engineering domain (ENGR). Computer labs are located in Swearingen and 300 South Main (across the street).
  2. Login to the computer. Your login name should be the same as you were assigned by USC when you registered. Change your password. If you've never logged in before, your password should be your Student ID. (A good password should be made up of a combination of letters, both uppercase and lowercase, and numbers.)
  3. Note the desktop (i.e., the appearance of the screen). Everyone’s desktop is identical now, but it’s your desktop. Take an inventory of the things on the desktop. You can change it as you wish at your convenience.
  4. What you need for CSCE 145 is primarily Internet Explorer, Java, Eclipse, and the textbook software.
  5. Double click on the My Computer icon to see what you have. In particular, there are several drives: such as C:, H:, P:, and Z:. We will concentrate on drive H:.
  6. Open the H: drive by double-clicking on it. Create a new folder on H: called csce145; open the csce145 directory by double-clicking on it; now create a lab01 directory.
  7. You are next going to place an icon on the desktop for eclipse. Locate the eclipse folder by clicking on the Start menu, then Programs, CSE Apps, and eclipse. Click on the eclipse icon using the right mouse button. From the menu that appears, choose "send to" and then "Desktop (shortcut)". This will place a shortcut to the eclipse development environment on your desktop for ease of use.
  8. Right click the eclipse shortcut that you just made and select properties. Go to Start in and put in the home directory that you made on your H: drive earlier (e.g.: H:\csce145)
  9. Open eclipse by double-clicking on its icon on the desktop. If the "Welcome" window appears, click on the icon for the "Workbench." Eclipse will request that you "Select a workspace." Choose the default, which should be H:\csce145\workspace. If it is not there, type it in and click OK.
  10. Use File/New/Project and then choose Java Project and click next. In the window that pops up, choose a project name of lab01 and click next.
  11. Finally click finish at the bottom.
  12. For the lab this week, you will write a Java program to do simple interaction with a user (you, in this case).
  13. Right click on lab01 in the left Package Explorer frame and choose "new class". In the window that pops up, choose a meaningful name for your class (e.g., FirstProgram) and type it in the Name box. In the "which method stubs would you like to create?" section, check the box for public static void main(String[] args). Click the Finish button.
  14. A new class file will be created with the basic code you will need for your assignment. Include the following statement at the beginning of the class so that you can use the Scanner class: import java.util.Scanner;
  15. Then, just below the line with public static void main(String[] args) type:
        System.out.println("Hello out there.");
        //two forward slashes means the rest of the line is a comment!!!!
    
        //make a String variable with your    first name -- change this to your first name
        String firstName = "Clint";
        //make a String variable with your last name -- change this to your last name
        String lastName = "Fuchs";
    
        //make a char variable that indicates the grade you want to make in this class
        char grade = 'A'; //note single quotes ' around characters
    
        //Finally output all of that information to the screen
        System.out.println("My first name is " + firstName + " and my last name is " + lastName +
                " and if I study hard, I will make a(n) " + grade + " in CSCE145!");
    
    
        //prompt the user to input two numbers to add
        System.out.println("I will now add two integer values, please enter the two integer values separated by a space: ");
    
        //now we need to create and connect a Scanner object to the keyboard
        Scanner keyboard = new Scanner(System.in);
    
        //now we can use the keyboard object to retrieve values from the user
        int value1 = keyboard.nextInt();
        int value2 = keyboard.nextInt();
        int result = value1 + value2;
    
        System.out.println("The result of adding " + value1 + " and " + value2 + " is: " + result);
    
        System.out.println("Goodbye");        
    
    If you make a typing mistake you can correct it with the backspace or delete key. If you have positioned the cursor somewhere else, then you can use the four arrow keys to get back to the correct line.
  16. Use the File/Save to save and compile the program. If there is an error while compiling your code it will show up in the tasks window of eclipse workbench with a red cross in the first column, description and line number where it occurs.
  17. Navigate to Run/Run As/Java Application menu to run your program. Run your program a few times so that you can see it work. Try to understand what each line of code is actually doing.

Congratulations! You've just written and run your first Java program (at least in CSCE 145).