COMP1406 Tutorial 1. Objectives: Getting Started:

Size: px
Start display at page:

Download "COMP1406 Tutorial 1. Objectives: Getting Started:"

Transcription

1 COMP1406 Tutorial 1 Objectives: Write, compile and run simple Java programs using the IntelliJ Idea IDE. Practice writing programs that require user input and formatted output. Practice using and creating simple objects. Learn how to submit an assignment in culearn. To practice solving problems that use IF statements, FOR/WHILE loops & the Math class. Getting Started: Here are some helpful reminders about using the Windows machines in the tutorial room. Please take care that you save your data somewhere that is external to the lab computer. In particular, be careful where you save your data while working on the school machines. It is possible that you may lose data on the school computers, because you did not move your data to your Z drive, dropbox, google drive, USB memory stick, it to yourself, etc., before you logged off. The loss of data will not be accepted as an excuse for late or missed assignments. IntelliJ Idea is the IDE (Integrated Development Environment) that will be used for tutorials in COMP1406. It is installed on all of the computers in the tutorial room. IntelliJ Idea is free and is available for MacOSX, Windows and Linux operating systems. You should use it on your home computer or laptop to write all of your programs in this course. You will be saving and zipping the project files to hand in for ALL of your assignments. Instructions for downloading and running IntelliJ on your own computer can be found at the end of this document. You can find the executable file for it by going to the Windows start menu and searching for it. Upon startup, you should see a window something like what is shown here: Once IntelliJ has started, you should see the following. Select "Create New Project" to continue: 1

2 A dialog box will appear. Select Java in the left size panel. Then select the New... button on the top right of the window and select JDK in the pop-up menu that appears: 2

3 Select the latest jdk (at least version 1.8.0) from the C:\Program Files\Java folder [Note: The Java folder is in C:\Program Files, NOT C:\Program Files (x86]. Then press OK: A new window will appear. Just click Next: 3

4 Type in Assignment 0 as the Project name, make sure the project location is saving to the Z: drive and then press Finish: Should be Z:\, not C:\ You should see the main workbench window appear: 4

5 Expand the project by clicking the triangle to the left of the Assignment 0 project. Then click the src folder: From the File menu, select New and then Java Class: 5

6 Enter HelloWorld as the class name: You should see a class template formed as shown here (although the name and data in the comment will differ): 6

7 Type in the whole program as shown here: Right-click on the program panel (i.e., on the panel that contains your code) and select Run 'HelloWorld.main()' from the pop-up menu: 7

8 Your program should now run and the result should appear in the bottom Console pane: 8

9 NOTE: If you get an error that says something along the lines of "Invalid Target Release", you may have to change the compiler settings. Go to the File menu and select Settings... then under the Build,Execution,Deployment heading, select Compiler and then Java Compiler. Make sure that it is set to the same Project bytecode version of 1.8 to match the jdk that we set earlier. Click Apply and then Close the window and try running the code again. Tutorial Problems: 1) Create a class called TaxProgram (right click on the src folder in IntelliJ and select New->Java Class) with the code shown below. It should compile and run. Currently, the program just asks the user for his/her taxable income and then the number of dependents that they have. import java.util.scanner; public class TaxProgram { public static void main(string args[]) { double income, fedtax, provtax; int dependents; System.out.print("Please enter your taxable income: "); income = new Scanner(System.in).nextDouble(); System.out.print("Please enter your number of dependents: "); dependents = new Scanner(System.in).nextInt(); fedtax = 0.0; provtax = 0.0; // Add code here Making use of the income and fedtax variables in the code, insert code at the end of the program so that it computes and displays the fedtax using the rules shown below: If the income is less than $29,590, the federal tax should be 17% of the income If the income is in the range from $29, to $59, then the federal tax should be:(17% of $29,590 + (26% of (the income minus $29,590)) If the income is $59,180 or more then the federal tax should be: (17% of $29,590) + (26% of $29,590) + (29% of (the income minus $59,180)) Test your code with the following values to make sure that it is correct before you continue: Income $25,000 $53,000 $65,000 FedTax $4,250 $11, $14,

10 Insert code at the end of the program so that it computes and displays the provincial tax and finally the total tax using the rules shown below: The base provincial tax will be: 42.5% of the federal tax The deductions for the provincial tax will be: $ $328 per dependent The provtax is then calculated $0 if the bas provincial tax is less than the deductions, otherwise as follows: base - deductions The total tax is the sum of the fedtax and the provtax. Test your code with the following values to make sure that it is correct: Income $25,000 $53,000 $65,000 Dependants FedTax $4,250 $11, $14, ProvTax $1, $3, $4, TotalTax $5, $15, $19, ) Adjust your code above so that it displays with the following output format by using System.out.println() statements as well as String.format(): Please enter your taxable income: Please enter your number of dependents: 1 Here is your tax breakdown: Income $25, Dependants Federal Tax $4, Provincial Tax $1, ============================ Total Tax $5,

11 3) Create the following class called ObjectTestProgram (cut/paste the code) which creates 3 objects and displays them: public class ObjectTestProgram { public static void main(string args[]) { String s; Date d; Color c; s = "Hello World"; d = new Date(); c = Color.RED; System.out.println(s); System.out.println(d); System.out.println(c); The code does not compile... JAVA gives a few errors: Error:(6, 9) java: cannot find symbol symbol: class Date location: class ObjectTestProgram Error:(7, 9) java: cannot find symbol symbol: class Color location: class ObjectTestProgram This is JAVA's way of telling you that it does not know where the Date and Color objects are. You have to "tell" JAVA where they are by using an import statement. One way to do this is to add the appropriate import statement to the top of your program. Add the following to the top of your code, and you should notice that Date objects are now recognized in your code and so no compile error will occur on those lines anymore. import java.util.date; Alternatively, instead of trying to remember the import statement, you can have IntelliJ write the import statement for you. For example, click on one of the Color words in your code and then press ALT-ENTER (I'm not sure what keys are to be pressed for a ios or Linux). You will see the following dialog box appear: This lets you choose which class to import. As it turns out, there are three different Color classes defined in JAVA and they appear in three different folders. Select the middle one shown above (since we will use JavaFX later). You will notice that the import statement is added to the top of your program and that the code will now compile and run. Note that we do not need to import the String class since it is part of the "automatically imported" java.lang package. Now the code should compile. Notice the output. Was it as you expected? 11

12 4) Now let us create our own object. Create a class called MyObjectTestProgram: To do this, select the src folder in the left pane and create a new Java Class called MyObjectTestProgram from the menu options by following the File/New/Java Class menu sequence. You should see the following appear (with your name and a different date though): /** * Created by Mark Lanthier on 5/5/2016. */ public class MyObjectTestProgram { Replace the code above with the following code (cut and paste it, to save time): public class MyObjectTestProgram { public static void main(string args[]) { MyObject x; System.out.println(x); Compile the code by right clicking on your code and selecting Compile '...ecttestprogram.java' from the pop-up menu. Note: If you get an error such as this: " Error: java: invalid target release 1.9"... you will have to make a change to your project settings. To do this, select Settings... from the File menu. The select Java Compiler under the Build,Execution,Deployment submenu in the left pane. Select 1.8 as the Project bytecode version and press OK. You should see this error: Error:(3, 9) java: cannot find symbol symbol: class MyObject location: class MyObjectTestProgram You will notice in your code that the word MyObject is in red, indicating that there is an error. The Java compiler is indicating that it has no idea what a MyObject object actually is and we are trying to "use" such an object in this program. We fix this by creating a MyObject class. Create a new Java Class called MyObject. The code for the MyObject class should simply be: public class MyObject { Compile the MyObject class. Congratulations! You have just defined your first object. Now let's see if you can use it. Go back and compile the MyObjectTestProgram. Now JAVA will understand that you want to use the MyObject object that you just defined (it knows this because a MyObject class has been compiled in the same directory). However, the code will still not compile because it generates the error: "variable x might not have been initialized". You will also notice that the x is underlined with a red wavy line in your code. Putting the mouse cursor over this line will tell you the error: 12

13 This is JAVA's "annoying" way of telling you that you did not give a value to variable x. Insert the following line of code between the variable's declaration and the System.out.println line... and then recompile: x = null; The code should now compile. Run the code (i.e., right click on the code and select Run 'MyObjectTestPr...main().java' from the pop-up menu. After you run it once, you will be able to run the program by using the green "play" button at the top right of the IntelliJ toolbar: When the program runs, you should see null displayed. null is JAVA's way of representing an undefined object. You see, even though we created a new MyObject variable x, we did not make a new MyObject object. We only made the variable to hold one. Change x = null; into x = new MyObject(); and then recompile and run your code. You should now see something like this displayed MyObject@140e19d (although the exact numbers and letters may vary). Congratulations! Now you have just created the first instance of your object. Make sure that you notice the difference between defining an object (as we did with MyObject x;) and creating an instance of our object (as we did with x = new MyObject();). Our MyObject object is very plain. You cannot do much with it at the moment. We can only make a bunch of MyObject objects and display them. Try changing your code to look like this: public class MyObjectTestProgram { public static void main(string args[]) { MyObject x1, x2, x3; x1 = new MyObject(); x2 = new MyObject(); x3 = new MyObject(); System.out.println(x1); System.out.println(x2); System.out.println(x3); 13

14 Run the code. Three MyObject objects are created, but all look different when displayed because the weird numbers/letters represent the location of the object in the computer's memory and since each object is a unique one, it is in a different location. Submit Your Work: Before we go any further, let's make sure that you can submit your work. We will create a zip file called Assignment 0.zip that contains all of the java files you wrote so far in this tutorial. Files included will include: HelloWorld.java, TaxProgram.java, ObjectTestProgram.java, MyObjectTestProgram.java and MyObject.java. NOTE THAT ALL SUBMITTED ASSIGNMENTS MUST BE ZIPPED (i.e.,.zip) PROJECT FILES. YOU WILL LOSE MARKS IF YOU ATTEMPT TO USE ANY OTHER COMPRESSION FORMATS SUCH AS.RAR,.ARC,.TGZ,.JAR,.PKG,.PZIP, etc... To do this, go to the folder that contains all of your files. The easiest way to do this is to right click on the src folder within the IntelliJ project and then select Show in Explorer from the menu that appears: A window will then come up showing you the folder that contains your source code. In fact, it will be the Assignment 0 project folder as shown on the next page: 14

15 You will need to expand the directory structure on the left side of the window by continually clicking on the > arrows for the highlighted folders until you click on Assignment 0, as shown above. We will actually zip the entire project folder. Right-click on the Assignment 0 folder in the left pane of the window and select Send to and then Compressed (zipped) folder as shown in the picture on the next page: 15

16 You will see the zipped file shown on the left pane: 16

17 This Assignment 0.zip file is what you will submit. Go to the COMP1406 page in culearn. You will find a submit Assignment 0 option in the assignments section. Clicking this will bring you to a page where you can upload your submission. If you want to load that project into IntelliJ on another computer, you will need to unzip that file on that new computer. Wherever you placed the zip file on your new computer, select it and unzip it by selecting the file and then right-clicking and selecting Extract All... from the popup menu: From the dialog box that appears, click Extract. It should by default, extract to the same folder that contains the zipped file: 17

18 To open the project in IntelliJ, select Open... from the File menu. Select the Assignment 0 folder that is inside of the Assignment 0 folder that you unzipped. MAKE SURE THAT YOU SELECT THE ONE INSIDE OF THE OTHER ONE as shown in the image on the next page: 18

19 The project should be loaded along with all of its original source files. The TAs will follow these steps in order to download and open your project code. MORE CHALLENGING QUESTIONS: 5) Consider the following program that asks the user for a series of exam marks and then computes the average. Create/Save/Compile and Run the program to make sure that it works: import java.util.scanner; public class ForLoopTestProgram { public static void main(string args[]) { int nums, sum; System.out.println("How many exam marks do you want to average? "); nums = new Scanner(System.in).nextInt(); sum = 0; // Get the numbers one at a time, and add them for (int count=1; count<=nums; count++) { 19

20 System.out.println("Enter exam mark " + count + ": "); sum += new Scanner(System.in).nextInt(); System.out.println("The average is " + (sum / nums)); You should get an answer of 59 if you entered 3 exam marks of 66, 25 and 87. Using another FOR loop, add any necessary code inside the existing FOR loop's body so that it displays the entered value followed by a space character and then a series of asterisks (i.e., *) for each value entered. There should be the same number of asterisks as the mark on the exam. Each mark should display on its own line. The result should be a kind of sideways bar graph as shown below. The results below should be produced if you entered 5 exam marks of 66, 25, 87, 91 and 15: 66 ****************************************************************** 25 ************************* 87 *************************************************************************************** 91 ******************************************************************************************* 15 *************** The average is 56 6) Copy your solution code above into a new class called WhileLoopTestProgram then Save/Compile and Run the code to make sure that it still works. Modify the code so that it no longer asks the user for the number of marks beforehand. Instead, it should use a WHILE loop to keep asking for marks until the user enters no mark (i.e., just presses the Enter key, leaving the option pane blank). You may have to alter some variables and add an if statement. Feel free to make any changes that you need. Make sure that it still computes the average correctly. 7) Write a program that takes a point object (x,y) to represent a robot's initial location (in centimeters) as well as its orientation (an angle called theta which is an integer value between 0 and 360 degrees). You can either set these values in your code directly or ask the user for them (using the Scanner class). They should all be integers. Assume the robot moves forward d centimeters. Compute and display the final location of the robot after it moves. The new location is computed as point (x + d cos(theta), y + d sin(theta)). Remember that the sine and cosine functions in JAVA use radians, not degrees. To convert degrees to radians, you need to multiply the degrees by Math.PI/180 and if you need to convert from radians to degrees you can multiply the radians by 180/Math.PI. Test your code...remembering that 0 degrees is to the right (as shown below in red), 90 degrees is up, 180 degrees is left and the angle theta shown below is around 135 degrees. 20

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

More information

St. Edmund Preparatory High School Brooklyn, NY

St. Edmund Preparatory High School Brooklyn, NY AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think

More information

Getting Started with Eclipse/Java

Getting Started with Eclipse/Java Getting Started with Eclipse/Java Overview The Java programming language is based on the Java Virtual Machine. This is a piece of software that Java source code is run through to produce executables. The

More information

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101.

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101. Creating and running a Java program. This tutorial is an introduction to running a computer program written in the computer programming language Java using the BlueJ IDE (Integrated Development Environment).

More information

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

2 Getting Started. Getting Started (v1.8.6) 3/5/2007 2 Getting Started Java will be used in the examples in this section; however, the information applies to all supported languages for which you have installed a compiler (e.g., Ada, C, C++, Java) unless

More information

RTMS - Software Setup

RTMS - Software Setup RTMS - Software Setup These instructions are for setting up the RTMS (Robot Tracking & Management System) software. This software will run on your PC/MAC and will be used for various labs in order to allow

More information

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

CS 201 Software Development Methods Spring Tutorial #1. Eclipse CS 201 Software Development Methods Spring 2005 Tutorial #1 Eclipse Written by Matthew Spear and Joseph Calandrino Edited by Christopher Milner and Benjamin Taitelbaum ECLIPSE 3.0 DEVELOPING A SIMPLE PROGRAM

More information

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment. CPS109 Lab 1 Source: Partly from Big Java lab1, by Cay Horstmann. Objective: i. To become familiar with the Ryerson Computer Science laboratory environment. ii. To obtain your login id and to set your

More information

Setting up your Computer

Setting up your Computer Setting up your Computer 1 Introduction On this lab, you will be getting your computer ready to develop and run Java programs. This lab will be covering the following topics: Installing Java JDK 1.8 or

More information

COMP1406 Tutorial 5. Objectives: Getting Started: Tutorial Problems:

COMP1406 Tutorial 5. Objectives: Getting Started: Tutorial Problems: COMP1406 Tutorial 5 Objectives: Learn how to create a window with various components on it. Learn how to create a Pane and use it in more than one GUI. To become familiar with the use of Buttons, TextFields

More information

AP Computer Science Unit 1. Writing Programs Using BlueJ

AP Computer Science Unit 1. Writing Programs Using BlueJ AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

Introduction to Java Unit 1. Using BlueJ to Write Programs

Introduction to Java Unit 1. Using BlueJ to Write Programs Introduction to Java Unit 1. Using BlueJ to Write Programs 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

Getting Started (1.8.7) 9/2/2009

Getting Started (1.8.7) 9/2/2009 2 Getting Started For the examples in this section, Microsoft Windows and Java will be used. However, much of the information applies to other operating systems and supported languages for which you have

More information

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION 15 3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION Checklist: The most recent version of Java SE Development

More information

JAVA PROGRAMMING (340)

JAVA PROGRAMMING (340) ANSWER KEY Page 1 of 10 JAVA PROGRAMMING (340) REGIONAL 2017 Production Portion: Program 1: School Vending Machine (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all

More information

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 Question One: Choose the correct answer and write it on the external answer booklet. 1. Java is. a. case

More information

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java) Goals - to learn how to compile and execute a Java program - to modify a program to enhance it Overview This activity will introduce you to the Java programming language. You will type in the Java program

More information

AP Computer Science Unit 1. Programs

AP Computer Science Unit 1. Programs AP Computer Science Unit 1. Programs Open DrJava. Under the File menu click on New Java Class and the window to the right should appear. Fill in the information as shown and click OK. This code is generated

More information

Workbook A dialog box will appear asking for you to select your "workspace". Leave the default as is, which should be /home/crsid/workspace.

Workbook A dialog box will appear asking for you to select your workspace. Leave the default as is, which should be /home/crsid/workspace. In this workbook you will learn how to use Eclipse as a development environment for Java programs. Using Eclipse, you will then write a simple Java messaging client which will allow you to send and receive

More information

Software Installation for CS121

Software Installation for CS121 Software Installation for CS121 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University August 26, 2005 1 Installation of Java J2SE 5 SDK 1. Visit Start Settings Control Panel

More information

CF Vector User Manual V

CF Vector User Manual V CF Vector User Manual V 1.0.0.0 1. The CF Vector application is a Windows Metro 8.1 application that can be used as an aid in learning about vectors. Two dimensional vectors [x,y] are used for simplicity.

More information

Summer Assignment for AP Computer Science. Room 302

Summer Assignment for AP Computer Science. Room 302 Fall 2016 Summer Assignment for AP Computer Science email: hughes.daniel@north-haven.k12.ct.us website: nhhscomputerscience.com APCS is your subsite Mr. Hughes Room 302 Prerequisites: You should have successfully

More information

Starting In Java With JPT in Eclipse

Starting In Java With JPT in Eclipse Starting In Java With JPT in Eclipse 1. Installing Java and Eclipse Both Java from Sun Microsystems and the Eclipse development environment are free to download. It is important that Java be installed

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

AP Computer Science Unit 1. Writing Programs Using BlueJ

AP Computer Science Unit 1. Writing Programs Using BlueJ AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

ASSIGNMENT 1 First Java Assignment

ASSIGNMENT 1 First Java Assignment ASSIGNMENT 1 First Java Assignment COMP-202B, Winter 2012, All Sections Due: Sunday January 29th, 2012 (23:30) Please read the entire pdf before starting. You must do this assignment individually and,

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018

AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018 AP Computer Science 2018 2019 E-mail: taegoode@vbschools.com Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018 This assignment is due on the first day of class. Please read the instructions carefully

More information

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation CPSC 150 Laboratory Manual A Practical Approach to Java, jedit & WebCAT Department of Physics, Computer Science & Engineering Christopher Newport University Lab 1 Introduction to Program Creation Welcome

More information

CS 152: Data Structures with Java Hello World with the IntelliJ IDE

CS 152: Data Structures with Java Hello World with the IntelliJ IDE CS 152: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Electrical and Computer Engineering building

More information

CompSci 125 Lecture 02

CompSci 125 Lecture 02 Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

Web-CAT Guidelines. 1. Logging into Web-CAT

Web-CAT Guidelines. 1. Logging into Web-CAT Contents: 1. Logging into Web-CAT 2. Submitting Projects via jgrasp a. Configuring Web-CAT b. Submitting Individual Files (Example: Activity 1) c. Submitting a Project to Web-CAT d. Submitting in Web-CAT

More information

Java using LEGO Mindstorms and LeJOS. University of Idaho

Java using LEGO Mindstorms and LeJOS. University of Idaho Java using LEGO Mindstorms and LeJOS University of Idaho 2 Contents 1 Introduction 1 1.1 Setting up Java and Eclipse................................ 1 1.2 Setting up the Lego Brick to work with LeJOS.....................

More information

Imperative and Object Oriented Programming. Tutorial 1. Charlie Abela Department of Artificial Intelligence

Imperative and Object Oriented Programming. Tutorial 1. Charlie Abela Department of Artificial Intelligence Imperative and Object Oriented Programming Tutorial 1 Department of Artificial Intelligence charlie.abela@um.edu.mt Tutorial 1 In this tutorial you will be using the BlueJ IDE to develop java classes.

More information

Instructions PLEASE READ (notice bold and underlined phrases)

Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercises wk02 Lab Basics First Lab of the course Required Reading Java Foundations - Section 1.1 - The Java Programming Language Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercise

More information

CS 116. Lab Assignment # 1 1

CS 116. Lab Assignment # 1 1 Points: 2 Submission CS 116 Lab Assignment # 1 1 o Deadline: Friday 02/05 11:59 PM o Submit on Blackboard under assignment Lab1. Please make sure that you click the Submit button and not just Save. Late

More information

Welcome to the CP Portal

Welcome to the CP Portal Welcome to the CP Portal Access your school documents from home Launch Internet Explorer and navigate to: https://files.cpcsc.k12.in.us/htcomnet/ Click on Continue to this website (not recommended) Key

More information

lejos NXJ Problem Solving with Robots [PRSOCO601]

lejos NXJ Problem Solving with Robots [PRSOCO601] lejos NXJ Problem Solving with Robots [PRSOCO601] Thomas Devine http://noucamp thomas.devine@lyit.ie February 20, 2008 1 Contents 1 lejos NXJ 4 1.1 Introducing the Java Development.......................

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1 COMP 210: Object-Oriented Programming Lecture Notes 1 Java Program Structure and Eclipse Robert Utterback In these notes we talk about the basic structure of Java-based OOP programs and how to setup and

More information

Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide

Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide School of Sciences Department of Computer Science and Engineering Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide WHAT SOFTWARE AM I GOING TO NEED/USE?... 3 WHERE DO I FIND THE SOFTWARE?...

More information

AP Computer Science A Summer Assignment 2017

AP Computer Science A Summer Assignment 2017 AP Computer Science A Summer Assignment 2017 The objective of this summer assignment is to ensure that each student has the ability to compile and run code on a computer system at home. We will be doing

More information

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Using Eclipse for Java. Using Eclipse for Java 1 / 1 Using Eclipse for Java Using Eclipse for Java 1 / 1 Using Eclipse IDE for Java Development Download the latest version of Eclipse (Eclipse for Java Developers or the Standard version) from the website:

More information

Arduino IDE Friday, 26 October 2018

Arduino IDE Friday, 26 October 2018 Arduino IDE Friday, 26 October 2018 12:38 PM Looking Under The Hood Of The Arduino IDE FIND THE ARDUINO IDE DOWNLOAD First, jump on the internet with your favorite browser, and navigate to www.arduino.cc.

More information

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup Purpose: The purpose of this lab is to setup software that you will be using throughout the term for learning about Python

More information

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to:

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to: Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002

Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002 Adding Existing Source Code in NetBeans CS288, Autumn 2005 Lab 002 Purpose This document will show how to incorporate existing source code within a NetBeans project. It will also introduce the concept

More information

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 Learn about cutting-edge research over lunch with cool profs January 18-22, 2015 11:30

More information

CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: Lab Instructions: Log in Create folder CS209

CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: Lab Instructions: Log in Create folder CS209 CS 209 Section 52 Lab 1-A: Getting Started with NetBeans Instructor: J.G. Neal Objectives: 1. To create a project in NetBeans. 2. To create, edit, compile, and run a Java program using NetBeans. 3. To

More information

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 Assignment Due Date Assignment 1 is now due on Tuesday, Jan 20 th, 11:59pm. Quiz 1 is

More information

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java

More information

1. Download the JDK 6, from

1. Download the JDK 6, from 1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the

More information

Comp Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings

Comp Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings Comp 401 - Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings Date Assigned: Thu Aug 29, 2013 Completion Date: Fri Sep 6, 2013 Early Submission Date: Wed Sep 4, 2013 This work

More information

Getting Started with Eclipse for Java

Getting Started with Eclipse for Java Getting Started with Eclipse for Java Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Publishing 1. Introduction 2. Downloading and Installing Eclipse 3. Importing and Exporting

More information

Lab 9: Creating a Reusable Class

Lab 9: Creating a Reusable Class Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

3 Getting Started with Objects

3 Getting Started with Objects 3 Getting Started with Objects If you are an experienced IDE user, you may be able to do this tutorial without having done the previous tutorial, Getting Started. However, at some point you should read

More information

1. An operation in which an overall value is computed incrementally, often using a loop.

1. An operation in which an overall value is computed incrementally, often using a loop. Practice Exam 2 Part I: Vocabulary (10 points) Write the terms defined by the statements below. 1. An operation in which an overall value is computed incrementally, often using a loop. 2. The < (less than)

More information

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang Eclipse Tutorial For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Getting Started with Eclipse Choosing a Perspective Creating a Project Creating a Java

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs Linux Tutorial #1 Introduction The Linux operating system is now over 20 years old, and is widely used in industry and universities because it is fast, flexible and free. Because Linux is open source,

More information

CSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck!

CSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck! CSCE 145 Exam 1 Review This exam totals to 100 points. Follow the instructions. Good luck! Chapter 1 This chapter was mostly terms so expect a fill in the blank style questions on definition. Remember

More information

ASSIGNMENT 1 Expressions, Data Types, and Simple Calculations

ASSIGNMENT 1 Expressions, Data Types, and Simple Calculations ASSIGNMENT 1 Expressions, Data Types, and Simple Calculations COMP-202B, Winter 2010, All Sections Due: Friday, January 22, 2010 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

Getting Started with Visual Studio

Getting Started with Visual Studio Getting Started with Visual Studio Visual Studio is a sophisticated but easy to use integrated development environment (IDE) for C++ (and may other languages!) You will see that this environment recognizes

More information

CMSC131. Introduction to your Introduction to Java. Why Java?

CMSC131. Introduction to your Introduction to Java. Why Java? CMSC131 Introduction to your Introduction to Java Why Java? It s a popular language in both industry and introductory programming courses. It makes use of programming structures and techniques that can

More information

CMPSCI 187 / Spring 2015 Postfix Expression Evaluator

CMPSCI 187 / Spring 2015 Postfix Expression Evaluator CMPSCI 187 / Spring 2015 Postfix Expression Evaluator Due on Thursday, 05 March, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015

More information

Lesson 5C MyClass Methods. By John B. Owen All rights reserved 2011, revised 2014

Lesson 5C MyClass Methods. By John B. Owen All rights reserved 2011, revised 2014 Lesson 5C MyClass Methods By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Defining your own class Defining and calling a static method Method structure String return

More information

Using Inbox and Views

Using Inbox and Views Left Mouse Button Using Inbox and Views In this tutorial, whenever we indicate that you need to click a mouse button, it will mean to click the left mouse button unless we indicate that you should click

More information

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio ECE2049 Embedded Computing in Engineering Design Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio In this lab, you will be introduced to the Code Composer Studio

More information

COMP Summer 2015 (A01) Jim (James) Young jimyoung.ca

COMP Summer 2015 (A01) Jim (James) Young jimyoung.ca COMP 1010- Summer 2015 (A01) Jim (James) Young young@cs.umanitoba.ca jimyoung.ca Hello! James (Jim) Young young@cs.umanitoba.ca jimyoung.ca office hours T / Th: 17:00 18:00 EITC-E2-582 (or by appointment,

More information

Ch. 6. User-Defined Methods

Ch. 6. User-Defined Methods Ch. 6 User-Defined Methods Func5onal Abstrac5on Func5onal regarding func5ons/methods Abstrac5on solving a problem in a crea5ve way Stepwise refinement breaking down large problems into small problems The

More information

Life Without NetBeans

Life Without NetBeans Life Without NetBeans Part A Writing, Compiling, and Running Java Programs Almost every computer and device has a Java Runtime Environment (JRE) installed by default. This is the software that creates

More information

Programming Basics. Digital Urban Visualization. People as Flows. ia

Programming Basics.  Digital Urban Visualization. People as Flows. ia Programming Basics Digital Urban Visualization. People as Flows. 28.09.2015 ia zuend@arch.ethz.ch treyer@arch.ethz.ch Programming? Programming is the interaction between the programmer and the computer.

More information

NetBeans IDE Java Quick Start Tutorial

NetBeans IDE Java Quick Start Tutorial NetBeans IDE Java Quick Start Tutorial Welcome to NetBeans IDE! This tutorial provides a very simple and quick introduction to the NetBeans IDE workflow by walking you through the creation of a simple

More information

Lesson 10: Quiz #1 and Getting User Input (W03D2)

Lesson 10: Quiz #1 and Getting User Input (W03D2) Lesson 10: Quiz #1 and Getting User Input (W03D2) Balboa High School Michael Ferraro September 1, 2015 1 / 13 Do Now: Prep GitHub Repo for PS #1 You ll need to submit the 5.2 solution on the paper form

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

Using Windows 7 Explorer By Len Nasman, Bristol Village Computer Club

Using Windows 7 Explorer By Len Nasman, Bristol Village Computer Club By Len Nasman, Bristol Village Computer Club Understanding Windows 7 Explorer is key to taking control of your computer. If you have ever created a file and later had a hard time finding it, or if you

More information

Java Basics Lecture: January 26, 2012 (On-line Lecture 1)

Java Basics Lecture: January 26, 2012 (On-line Lecture 1) Java Basics Lecture: January 26, 2012 (On-line Lecture 1) CMPSCI 121, Spring 2012 Introduction to Problem Solving with Computers Prof. Erik Learned-Miller Logistics Previous lectures are on-line. See links

More information

13 th Windsor Regional Secondary School Computer Programming Competition

13 th Windsor Regional Secondary School Computer Programming Competition SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse

More information

Engr 123 Spring 2018 Notes on Visual Studio

Engr 123 Spring 2018 Notes on Visual Studio Engr 123 Spring 2018 Notes on Visual Studio We will be using Microsoft Visual Studio 2017 for all of the programming assignments in this class. Visual Studio is available on the campus network. For your

More information

AP Computer Science. Return values, Math, and double. Copyright 2010 by Pearson Education

AP Computer Science. Return values, Math, and double. Copyright 2010 by Pearson Education AP Computer Science Return values, Math, and double Distance between points Write a method that given x and y coordinates for two points prints the distance between them If you can t do all of it, pseudocode?

More information

Introduction to IntelliJ

Introduction to IntelliJ Introduction to IntelliJ IntelliJ is a large software package used by professional software developers. This document will give you a brief introduction but is by no means exhaustive. If you have questions

More information

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below.

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below. CS520 Setting Up the Programming Environment for Windows Suresh Kalathur 1. Java8 SDK Java8 SDK (Windows Users) For Windows users, download the Java8 SDK as shown below. The Java Development Kit (JDK)

More information

What did we talk about last time? Examples switch statements

What did we talk about last time? Examples switch statements Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation

More information

Prerequisites for Eclipse

Prerequisites for Eclipse Prerequisites for Eclipse 1 To use Eclipse you must have an installed version of the Java Runtime Environment (JRE). The latest version is available from java.com/en/download/manual.jsp Since Eclipse includes

More information

Getting Started with Web Services

Getting Started with Web Services Getting Started with Web Services Getting Started with Web Services A web service is a set of functions packaged into a single entity that is available to other systems on a network. The network can be

More information

FSA Geometry EOC Practice Test Guide

FSA Geometry EOC Practice Test Guide FSA Geometry EOC Practice Test Guide This guide serves as a walkthrough of the Florida Standards Assessments (FSA) Geometry End-of- Course (EOC) practice test. By reviewing the steps listed below, you

More information

Name: Checked: Preparation: Use variables to output a personalized message

Name: Checked: Preparation: Use variables to output a personalized message Lab 2 Name: Checked: Objectives: Learn about keyboard input to Java programs using the Scanner class. Practice using variables and assignment Experiment with simple arithmetic using the jgrasp Interactions

More information

Midterm Examination (MTA)

Midterm Examination (MTA) M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and

More information

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE PART 1 Eclipse IDE Tutorial Eclipse Java IDE This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs and tips for using Eclipse.

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

Lesson 04: Our First Java Program (W01D4

Lesson 04: Our First Java Program (W01D4 Lesson 04: Our First Java Program (W01D4) Balboa High School Michael Ferraro Lesson 04: Our First Java Program (W01D4 Do Now Start a terminal shell. From there, issue these commands

More information

COMP-202: Foundations of Programming. Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 4: Flow Control Loops Sandeep Manjanna, Summer 2015 Announcements Check the calendar on the course webpage regularly for updates on tutorials and office hours.

More information

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 Announcements Midterm Exams on 4 th of June (12:35 14:35) Room allocation will be announced soon

More information

COMP1406 Tutorial 3. // A simple constructor public Customer(String n, int a, char g, float m) { name = n; age = a; gender = g; money = m; }

COMP1406 Tutorial 3. // A simple constructor public Customer(String n, int a, char g, float m) { name = n; age = a; gender = g; money = m; } COMP1406 Tutorial 3 Objectives: Learn how to create multiple objects that interact together. To get practice using arrays of objects. Understand the private and public access modifiers. Getting Started:

More information

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008 1 ECSE-323 Digital System Design Lab #1 Using the Altera Quartus II Software Fall 2008 2 Introduction. In this lab you will learn the basics of the Altera Quartus II FPGA design software through following

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition

IntelliJ IDEA Getting Started Guide for FIRST Robotics Competition IntelliJ IDEA 2016.1 Getting Started Guide for FIRST Robotics Competition 1 PRE-REQUISITES GitHub account. Knowledge of your computer and how to use it. Administrator Account on your computer. Access to

More information