Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CS140, TSU Introduction to Computers and Java by Li Ma Overview of CS120 CS120 is an integrated introduction to problem solving using computers, which teaches students how real-world problems can be solved using computer programming languages Concepts and techniques covered in CS120: data representation and number systems basic components of computer systems problem solving strategies introduction to algorithms and pseudo code introduction to programming languages introduction to operating systems Introduction to Computers Computer systems hardware components o input devices, output devices, memory, CPU, ALU, secondary storage, communication devices, … software components o system software: operating systems, utility programs o application software Data hierarchy Bits: the smallest data items Characters: a character – 1 byte – 8 bits, American Standard Code for Information Interchange (ASCII) Fields: a group of characters or bytes that conveys meaning Records: several related fields Files: a group of related records Computer Organization Input unit Output unit Memory unit ALU CPU 1 CS140, TSU Introduction to Computers and Java by Li Ma Secondary storage unit Programming languages Machine languages: strings of bits, slow and tedious Assembly languages: English-like abbreviations, need too many instructions High-level languages Object-Oriented Programming and Java Object-oriented programs are often easy to understand, correct, and modify. Objects (class objects) are essentially reusable software components in an object-oriented program The key object-oriented programming concepts Method: house the program statements that actually perform the tasks, but hide them from the users Class: program unit that house the set of methods that perform the class’s tasks Object: an instance of the class Reuse: a class can have many objects Method call: send messages to an object Instance variables: hold attributes of the object Encapsulation: classes wrap attributes and methods into objects (information hiding) Inheritance: the new class absorbs the characteristics of an existing class, possibly customizing them and adding unique characteristics of its own Polymorphism: a variable can reference objects of different types, can use the correct methods regarding to the type of the referenced object Java is one of the object-oriented programming languages. A key goal of Java is to be able to write programs that will run on a great variety of computer systems and computer-control devices. Java development environment: Java SE Development Kit (JDK) for Windows Java compiler (javac) and Java interpreter (java) on Microsoft Command Prompt JCreator LE Five phases to create a Java program: 1. Edit: => source code (*.java), editor 2. Compile: => bytecode (*.class), compiler 2 CS140, TSU Introduction to Computers and Java by Li Ma 3. Load: transfer the bytecodes to the primary memory, class loader 4. Verify: examine the bytecodes, bytecode verifier 5. Execute: run the bytecodes The Programming Process 1. Clearly define what the program is to do 2. Visualize the program running on the computer 3. Use design tools such as hierarchy chart, flowcharts, or pseudocode to create a model of the program 4. Check the model for logic errors 5. Type the code, save it, and compile it 6. Correct any errors found during compilation. Repeat steps 5 and 6 as many times as necessary 7. Run the program with test data for input 8. Correct any errors found while running the program. Repeat steps 5 through 8 as many time as necessary 9. Validate the results of the program (output) 3