Exam Prep.docx

7 Pages
Unlock Document

Information Technology Management
ITM 200
Youcef Derbal

Using Notepad to write a program 1. Do Run and then type cmd 2. cd c:/ITM200 - This like finds and makes the folder you are working with 3. javac - This command Compiles 4. java Hello - This runs the whole thing, hello being the file 5. dir - Gives you information about the folder Class – Structures and organises a program; has to have the same name as the program itself  class QuadraticEq { Methods – All instructions must be inside a method; Every Java program must have one main() method.  public static void main(String[] args) { o public static are key words o void is a keyword which indicates that the main method does not return a value o args is a parameter that allows us to pass arguments (data) to the main method Attributes (data or variables) – represent the relevant characteristics of the object Compiler – Converting java code to binary so the computer can understand Parenthesis – The brackets Parameters - limitations on a program Operations (functions and methods) – are what an object does, or has done to it, they represent the behaviour of the object Algorithms – Set of instructions for solving a problem Boolean – Value must be true or false Pseudocode - a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of some programming language, but is intended for human reading rather than machine reading. Example IF, WHILE, ELSE  WHILE throw is not 5 o Roll Dice o Add to Total Comments – Text that is ignored by the compiler, it is used to tell the reader what is happening; we use //Write text here Dry Run – looking through the program to find errors Variables – to operate data  int – whole numbers only, no decimals example: int age;  char – where you place characters example: char ‘A’;  double – any number can be put in this example: double distance; Identifier –the name of a variable, class, or method; can’t be a digit Operator Precedence 1. ( ) 2. ! 3. * / % 4. + - 5. < <= = >= > != 6. ++ !+ 7. && 8. || Modulus % - the remainder after an integer division Example: 8 % 7 = 1 AND - && OR - || Final double rate = 8.4  prevent the variable from being changed Primitive Type Variable – takes up a box of memory in which data value can be stored Reference Type Variable – address of an object can be stored after which the object can be referenced by using the name of the reference variable Java Applications programming interface (API) – enormous collection of pre-written tried and tasted classes IOException - Exceptions are objects that describe error condition that may occur during the execution of a program  NullPointerException - occurs when calling the method of a null object  IndexOutOfBoundException - reference to a position beyond the length of an array  NumberFormatException - trying to convert a non numerical character strings to a number Programming errors  Syntax Errors - errors that are accompanied by messages from the compiler that help to pinpoint problems usually has to do with spelling, Punctuation, and grammar  Semantic Errors (Logic) - it will run successfully, in the sense that the computer will not generate any error messages, but it will not do the right thing. It will do something else. Specifically, it will do what you told it to do.  Type Error – type of expression; incompatible types  Run-Time error - An error in a program that causes execution of the program to be terminated. These are caused by misuses of the language that the compiler cannot detect and so are detected only when the program is run. They might include sending messages to null, dividing integers by zero, trying to access non-existent elements of an array, etc. Inheritance - Refers to the relationship between distinct classes that share common properties and methods Composition - refers to the case when a class has properties whose types are other classes Methods: public class xxx {  public static void main(String[] args) throws IOException {  public static void main(String[] args) { Exports:  import java.io.BufferedReader;  import java.io.FileReader;  import java.io.BufferedWriter;  import java.io.FileWriter;  import java.io.IOException;  import java.io.PrintWriter;  import javax.swing.JOptionPane; javax.swing.JOptionPane.showMessageDialog(null,"The Average is: " + average);  To display a message String numString1 = JOptionPane.showInputDialog(“Enter your first integer”);  You enter a message int firstNum = Integer.parselnt(numString1);  Converts string to integer double firstNum = Double.parseDouble(numString1);  Converts string to
More Less

Related notes for ITM 200

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.