23 Mar 2013

tugas alpro -3 chapter 1


Overview Of Computers and Programming 1.1 Electronic Computers Then and Now These early computers used vacuum tubes as their basic electronic component. Technological advances in the design and manufacture of electronic components led to new generations of computers that were considerably smaller, faster, and less expensive than previous ones. • The Intel Atom processor chip contains the full circuitry of a central processing unit in an integrated circuit whose small size and low power requirements make it suitable for use in mobile internet devices • (Intel Corporation Pressroom Photo Archives) computer chip (microprocessor chip) a silicon chip containing the circuitry for a computer processor hardware the actual computer equipment software the set of programs associated with a computer program a list of instructions that enables a computer toperform a specific task binary number a number whose digits are 0 and 1 1.2 Computer Hardware Essentially, most consist of the following components: Main memory Secondary memory, which includes storage devices such as hard disks, CDs, DVDs, and flash drives Central processing unit Input devices, such as keyboards, mouses, touch pads, scanners, joysticks Output devices, such as monitors, printers, and speakers Memory Memory is an essential component in any computer. memory cell an individual storage location in memory address of a memory cell the relative position of a memory cell in the computer’s main memory contents of a memory cell the information stored in a memory cell, either a program instruction or data stored program concept a computer’s ability to store program instructions in main memory for execution byte the amount of storage required to store a single character bit a binary digit; a 0 or a 1 1000 Memory Cells in Main Memory 00101100 Byte Bit Relationship Between a Byte and a Bit data storage setting the individual bits of a memory cell to 0 or 1, destroying its previous contents data retrieval copying the contents of a particular memory cell to another storage area random access memory (RAM) the part of main memory that temporarily stores programs, data, and results. read-only memory (ROM) the part of main memory that permanently stores programs or data volatile memory memory whose contents disappear when the computer is switched off secondary storage units such as disks or flash drives that retain data even when the power to the drive is off disk thin platter of metal or plastic on which data are represented by magnetized spots arranged in tracks optical drive device that uses a laser to access or store data on a CD or DVD flash drive device that plugs into USB port and stores data bits as trapped electrons file named collection of data stored on a disk directory a list of the names of files stored on a disk subdirectory a list of the names of files that relate to a particular topic. Central Processing Unit central processing unit (CPU) coordinates all computer operations and performs arithmetic and logical operations on data fetching an instruction retrieving an instruction from main memory, register high-speed memory location inside the CPU multiprocessor a computer with more than one CPU. Input/Output Devices cursor a moving place marker that appears on the monitor function keys special keyboard keys used to select a particular operation; operation selected depends on program being used mouse an input device that moves its cursor on the computer screen to select an operation icon a picture representing a computer operation hard copy a printed version of information Computer Networks local area network(LAN) computers, printers, scanners, and storage devices connected by cables for intercommunication digital subscriber line ( DSL connection ) or fiber-optics telephone line, the associated file server the computer in a network that controls access to a secondary storage device such as a hard disk wide area network (WAN) a network such as the Internet that connects computers and LANs over a large geographic area World Wide Web (WWW) a part of the Internet whose graphical user interfaces make associated network resources easily navigable graphical user interface (GUI) pictures and menus displayed to allow user to select commands and data modem a device that converts binary data into audio signals that can be transmitted between computers over telephone lines DSL connection (digital subscriber line) a high-speed Internet connection that uses a telephone line and does not interfere with simultaneous voice communication on the same line cable Internet access two-way highspeed transmission of Internet data through two of the hundreds of channels available over the coaxial cable that carries cable television signals 1.3 Computer Software Operating System operating system (OS) software that controls interaction of user and computer hardware and that manages allocation of computer resources booting a computer loading the operating system from disk into memory Application Software application software used for a specific task such as word processing, accounting, or database management install make an application available on a computer by copying it to the computer’s hard drive. Computer Languages machine language binary number codes understood by a specific CPU assembly language mnemonic codes that correspond to machine language instructions high-level language machine-independent programming language that combines algebraic expressions and English symbols compiler software that translates a highlevel language program into machine language source file file containing a program written in a high-level language; the input for a compiler syntax grammar rules of a programming language object file file of machine language instructions that is the output of a compiler linker software that combines object files and resolves crossreferences to create an executable machine language program integrated development environment (IDE) software package combining a word processor, compiler, linker, loader, and tools for finding errors. Executing a Program input data the data values that are scanned by a program program output the lines displayed by a program 1.4 The Software Development Method Software Development Method 1. Specify the problem requirements. 2. Analyze the problem. 3. Design the algorithm to solve the problem. 4. Implement the algorithm. 5. Test and verify the completed program. 6. Maintain and update the program. abstraction the process of modeling a problem by extracting the essential variables and their relationships algorithm a list of steps for solving a problem top-down design breaking a problem into its major subproblems and then solving the subproblems stepwise refinement development of a detailed list of steps to solve a particular step in the original algorithm desk checking the step-by-step simulation of the computer execution of an algorithm. 1.5 Applying the Software Development Method CASE STUDY Converting Miles to Kilometers PROBLEM Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. ANALYSIS The first step in solving this problem is to determine what you are asked to do. You must convert from one system of measurement to another, but are you supposed to convert from kilometers to miles, or vice versa? The problem states that you prefer to deal in metric measurements, so you must convert distance measurements in miles to kilometers. Therefore, the problem input is distance in miles and the problem output is distance in kilometers . To write the program, you need to know the relationship between miles and kilometers. Consulting a metric table shows that one mile equals 1.609 kilometers. The data requirements and relevant formulas are listed below. miles identifies the memory cell that will contain the problem input and kms identifies the memory cell that will contain the program result, or the problem output. DATA REQUIREMENTS Problem Input miles /* the distance in miles*/ Problem Output kms /* the distance in kilometers */ Relevant Formula 1 mile = 1.609 kilometers DESIGN Next, formulate the algorithm that solves the problem. Begin by listing the three major steps, or subproblems, of the algorithm. ALGORITHM 1. Get the distance in miles. 2. Convert the distance to kilometers. 3. Display the distance in kilometers. Now decide whether any steps of the algorithm need further refinement or whether they are perfectly clear as stated. Step 1 (getting the data) and step 3 (displaying a value) are basic steps and require no further refinement. Step 2 is fairly straightforward, but some detail might help: Step 2 Refinement 2.1 The distance in kilometers is 1.609 times the distance in miles. We list the complete algorithm with refinements below to show you how it all fits together. The algorithm resembles an outline for a term paper. The refinement of step 2 is numbered as step 2.1 and is indented under step 2. ALGORITHM WITH REFINEMENTS 1. Get the distance in miles. 2. Convert the distance to kilometers. 2.1 The distance in kilometers is 1.609 times the distance in miles. 3. Display the distance in kilometers. Let’s desk check the algorithm before going further. If step 1 gets a distance of 10.0 miles, step 2.1 would convert it to 1.609 _ 10.00 or 16.09 kilometers. This correct result would be displayed by step 3. FIGURE 1.13 Miles-to-Kilometers Conversion Program 1. /* 2. * Converts distance in miles to kilometers. 3. */ 4. #include /* printf, scanf definitions */ 5. #define KMS_PER_MILE 1.609 /* conversion constant */ 6. 7. int 8. main(void) 9. { 10. double miles, /* input - distance in miles. */ 11. kms; /* output - distance in kilometers */ 12. 13. /* Get the distance in miles. */ 14. printf(“Enter the distance in miles> ”); 15. scanf(“%lf”, &miles); 16. 17. /* Convert the distance to kilometers. */ 18. kms = KMS_PER_MILE * miles; 19. 20. /* Display the distance in kilometers. */ 21. printf(“That equals %f kilometers.\n”, kms); 22. 23. return (0); 24. } Sample Run Enter the distance in miles> 10.00 That equals 16.090000 kilometers. 1.6 Professional Ethics for Computer Programmers Privacy and Misuse of Data computer theft (computer fraud) Illegally obtaining money by falsifying information in a computer database Computer Hacking virus Code attached to another program that spreads through a computer’s disk memory, disrupting the computer or erasing information worm A virus that can disrupt a network by replicating itself on other network computers Plagiarism and Software Piracy software piracy Violating copyright agreements by illegally copying software for use in another computer Misuse of a Computer Resource Computer system access privileges or user account codes are private property. These privileges are usually granted for a specific purpose—for example, for work to be done in a particular course or for work to be done during the time you are a student at your university. The privilege should be protected; it should not be loaned to or shared with anyone else and should not be used for any purpose for which it was not intended. When you leave the institution, this privilege is normally terminated and any accounts associated with the privilege will be closed. Computers, computer programs, data, and access (account) codes are like any other property. If they belong to someone else and you are not explicitly given permission to use them, then do not use them. If you are granted a use privilege for a specific purpose, do not abuse the privilege or it will be taken away. Legal issues aside, it is important that we apply the same principles of right and wrong to computerized property and access rights as to all other property rights and privileges. If you are not sure about the propriety of something you want to do, ask first. As students and professionals in computing, we set an example for others. If we set a bad example, others are sure to follow. JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ


Tidak ada komentar:

Posting Komentar