Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software...

download Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.

If you can't read please download the document

description

WeekTopic 1-2 Introduction to basic concepts of writing code, compilation, and execution 3Using Classes/Objects/Data members as building blocks 4Defining methods: parameters, return values 5-6 Primitive data types and operations (variables, types, assignment, and expressions) 7-8Control statements 9-11Loops and arrays 12-13Vectors 14Input/output via console 3

Transcript of Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software...

Lecture1 Instructor: Amal Hussain ALshardy Introduce students to the basics of writing software programs including variables, types, arrays, control structures, input/output, and general rules for writing good code. 2 WeekTopic 1-2 Introduction to basic concepts of writing code, compilation, and execution 3Using Classes/Objects/Data members as building blocks 4Defining methods: parameters, return values 5-6 Primitive data types and operations (variables, types, assignment, and expressions) 7-8Control statements 9-11Loops and arrays 12-13Vectors 14Input/output via console 3 1)quizzes (10%) 2)Lap exam (20%) 3)Midterm (30%) 4)Final Exam (40%) 4 -Students will be able to solve problems using programming. -Students will learn to use professional programming coding style and comments to improve code readability and maintainability. -Students will learn to write error-free code using debugging and testing techniques. 5 a. An ability to apply knowledge of mathematics, computing, science, and engineering appropriate to the discipline Students apply knowledge of programming to solve simple programming problems. b. An ability to analyze a problem, and identify and define the computing requirements appropriate to its solution Students acquire the ability to study programming problems and write programs that realize the required logic. c. An ability to design, implement and evaluate a computer-based system, process, component or program to meet desired needs Students are required to write (implement) their assignment in the form of methods to be called from the main method and test their methods by passing different appropriate values. d. An ability to function effectively on teams to accomplish a common goal --- e. An understanding of professional, ethical, legal and social issues and responsibilities Students will understand the importance of code readability and maintainability. i. An ability to use the current techniques, skills, and tools necessary for computing practice. Students use the command line and an IDE for writing, formatting, compiling, running, and debugging code. 6 7 computer programs, known as software, are instructions that tell a computer what to do. : 8 9 1)Machine language: a computer native language_set of builtin primitive instructions, in form of Binary Code. 10 2)Assembly Language: Assembly language uses a short descriptive word to represent each of the machine- language instructions 11 SUB AX,BX . Assembler Assembler translate assembly language into machine code :3)High-Level Languages English-like and easy to learn and use, you can write the program and run it, for example: C++, C#, Visual Basic, Java..etc 12 13 Introduction to Java: What Is Java? Getting Started With Java Programming Create, Compile and Running a Java Application High level programming language :that Developed by James Gosling and Sun Microsystems Developing software running on mobile devices, desktop computers and servers. Oak in 1991 for use in embedded chips in consumer electronic appliances In 1995 named Java and redesigned for developing Web application. 14 -Write a Simple Java Application -Compiling Programs -Executing Applications 15 16 public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } You save a java program in a.java file And compile it into a.class file. The.class file executed by java virtual machine 1)Program written in the notepad editor 17 Source code Output Note that line number for reference purposes only 2)The program written in the Netbeans IDEs (Integrated Developmen t Environment You have to create your program and compile it before it can be executed. This process is repetitive. If your program has compile errors or run time errors you have to modify the program to fix them, and then recompile it, and execute it again. A java compiler translates a java source file into a java bytecode file. The following command compiles Welcome.java: javac Welcome.java If there arent any errors, the compiler generate a bytecode file with a.class extension. Thus, the preceding command generates a file named Welcome.class and this file is executed using java command. 18 Write this command in the Command Prompt Javac ClassName.java 19 Java language is high level language, but java bytecode is a law level language. The bytecode is similar to machine instructions but is architecture neutral and can run on any platform that has a java virtual machine(JVM). (JVM): is a program that interprets java bytecode. 20 Welcome.java (java source code file) Welcome.class (java bytecode executable file) Java compiler JVM Library code Compiled byGeneratesExecuted by Java ClassName java bytecode can be executed in any computer with a Java Virtual Machine. 21 Any computer Any computer JVM Java Bytecode On command line java classname 22 23 24