INTRODUCTION TO COMPUTER SCIENCE 1 (CSC 111)

What is a Computer? A computer can simply be described as a powerful electronics device which has the capability of accepting data as (input) in a prescribed format, apply a series of arithmetic and logical operation on the data (processing) and produce the result of these operation as an (output) in a specified format at a very fast speed under the control of a logical sequence of instruction called "PROGRAM". A computer can simply be defined as an electronic device which accepts input (data), process it and gives desired output (information) under the instructions of stored program. From the description above, a computer can be described as an input - process-output (IPO) system, pictorially represented in the figure below

Input Processing Output

(Data) (Information) Fig. 1 A schematic diagram to define a computer A computer is a system and the word system has several commonly used definitions and meaning. There are for example the digestive system, grading system, electronic system and telephone system among others. In all these, one thing is clear and is the fact that in a system, there is more than one part. A system is an integration of two or more devices that are connected together to form a whole. Therefore, a computer system is a group of devices that under the control of stored programs process data into information. In a more comprehensive form, a computer system can be defined as an electronic machine which under the control of stored programs accepts data through the input device, process it into information which can be stored in its memory for later use or communicated to the user through any available output device. It can also be defined as an electronic machine which by means of stored instructions performs rapid, often complex calculations or compiles, correlates and selects data. Basically, a computer can be thought of as a machine that manipulates information in the form of numbers and characters. It is a device that works under the control of stored programs, automatically accepting, storing and processing data to produce information. What makes computer remarkable and appreciated is the speed and precision with which it can store, retrieve and manipulate data. Computer system is different from other systems because it works under the control of stored program.

HISTORY OF COMPUTER The Abacus and the Personal Computers are two lap sized data processing devices separated by thousands of years of history.

ABACUS was the first manual calculating device developed in China around 3000BC which is used by children for playing these days. It is having rows of beads in iron rods in a rectangular frame. Counting was done by shifting beads from one side to another. First mechanically CALCULATING machine was made by French mathematician Blaise Pascal in 1642. It had wheels of 10 segments with interconnected gears such hat when one wheel moved by one revolution, other moved by 1/10th of its revolution. Charles Babbage was the first person to develop a fully developed computer in 1883, which was named the Difference Engine, but it was a mechanical computer as it had all mechanical parts. It could do an addition in one second. The arrival of modern electronic computers was in the middle of 20th century with the computer named ENIAC, the first electronic computer.

GENERATION OF COMPUTERS The first electronic computer was designed and built at the University of Pennsylvania based on vacuum tube technology. Vacuum tubes were used to perform logic operations and to store data. From ENIAC to Artificial Intelligence Systems, the computers have been divided into five generations. They have been divided into five according to the development of technologies used to fabricate the processors, memories and I/O units. 1st Generation: 1946 – 1959 2nd Generation: 1959 – 1965 3rd Generation: 1965 – 1970 4th Generation: Since 1970 5th Generation: Around 1990s to present First Generation (1946 – 1959) In this generation, Vacuum Tubes, also called Valves were used and the computers of this generation were ENIAC - Electronic Numerical Integrator And Calculator, EDSAC – Electronic Delay Storage Automatic Calculator, EDVAC – Electronic Discrete Variable Automatic Computer, and UNIVAC – Universal Automatic Computer. Around 1950, the first generation of computer was used for US census. Characteristics: . Physically very large in size . Contained Vacuum tubes . Limited memory . Occupy more space . Consume more power with limited performance . Punched cards and paper tape were invented to feed programs and data and to get results. . Used Magnetic tape as secondary memory . Slow processing speed (in milliseconds) . High cost ENIAC had 18,000 vacuum tubes, 70,000 resistors, 10,000 capacitors. It had a weight of 27 tons (27,000kg!) and uses about 130 KW of power. It required about 1500 sq meter of space. Below is a picture of the ENIAC.

Second Generation (1959 - 1965) In this generation, Transistors were used to manufacture computers. Examples of second generation computers are IBM 1400 series, IBM 7000 series, LEO MARK –III. The Second generation computer is shown in the picture below.

Characteristics: . Reduced physical size . Transistor used instead of Vacuum tubes (invented at AT&T Bell lab in 1947) . Larger memory . Less space . Greater processing speed (in microseconds) . Comparatively cheaper . Increased reliability . Batch processing and Faster Inputs and Outputs . Less power consumption and better performance . Used magnetic ferrite core memories as main memory which is a random-access nonvolatile memory . Used magnetic tapes and magnetic disks as secondary memory . Increasingly used in business, industry and commercial organizations for preparation of payroll, inventory control, marketing, production planning, research, scientific & engineering analysis and design etc.

Third Generation (1965 - 1970) In this generation, Integrated Circuits (IC’s) were used. The mainframe computers like IBM 260, DEC 10, ICL 1900 and 2900 series & mini like Digital PDP-11, VAX range are examples of this generation The advances in microelectronics led to the advent of integrated circuits, which combines tens to thousand to hundreds of thousands of functional units into one chip. The machines were built using integrated circuit and there are small, medium, large and very large-scale integrated circuits depending on the level of integration. Third generation computer uses small, medium and large integration circuits. It is shown below.

Characteristics: . Greater reduction in Physical size . Technology used was IC’s instead of Transistors. One IC has 100s of transistors. . Higher speed of computation (in nanoseconds) . Increased reliability . Time sharing and multiprocessing . Mass storage devices with random access capability . Comparatively less cost . Faster processors . In the beginning magnetic core memories were used. Later they were replaced by semiconductor memories (RAM & ROM).

Fourth Generation (since 1970) In this generation Very Large Scale Integrated (VLSI) technology was used. Computers using microprocessors such as Personal Computer (PC, PC-XT, PC-AT) are examples of this generation of computers. Other examples are ICL 29 series, Micro VAX system, Intel’s 8088,80286,80386,80486 .., Motorola’s 68000, 68030, 68040, Apple II, and CRAY I/2/X/MP. Below is a picture of one of the earliest PCs.

Characteristics: Design Point of View: . Increased Input and Output (I/O) capability . Greater system reliability . Technology used was VSLI (Very Large Scale Integration). Tens of thousands of transistors can be placed in a single chip (VLSI design implemented) . Emergence of PCs . Semiconductor memory chips were used as the main memory. . Secondary memory was composed of hard disks – Floppy disks & magnetic tapes were used for backup memory . Less power consumption . High performance, lower cost and very compact . Introduction of Networking. Functional Point of View . More powerful languages . Use of multi programming and multiprocessing OS (Operating System). . Shifting from batch processing to On-line, remote, interactive processing.

Fifth Generation (Around 1990’s) Fifth generation computing devices, based on artificial intelligence, are still in development, though there are some applications, such as voice recognition, that are being used today. The use of parallel processing and superconductors is helping to make artificial intelligence a reality. The goal of fifth-generation computing is to develop devices that respond to natural language input and are capable of learning and self-organization. IBM notebooks, Pentium PCs-Pentium 1/2/3/4/Dual core/Quad core, SUN work stations, Origin 2000, PARAM 10000, IBM SP/2 are all examples of this generation computers. Characteristics: . Introduced of Artificial Intelligence (AI) . Evolution of data flow architecture and functional languages . Development of expert systems . Introduced ULSI (Ultra Large Scale Integration) technology – Intel’s Pentium 4 microprocessor contains 55 million transistors millions of components on a single IC chip. . Memory chips up to 1 GB, hard disk drives up to 180 GB and optical disks up to 27 GB are available (still the capacity is increasing) . Portable note book computers introduced . Storage technology advanced – large main memory and disk storage available . Introduced World Wide Web and other existing applications like e-mail, e Commerce, Virtual libraries/Classrooms, multimedia applications etc.) . New operating systems developed – Windows 95/98/XP/…, LINUX, etc. NOTE: From first to fifth generation, computers become smaller, lighter, cheaper, more efficient and reliable.

CLASSIFICATION OF COMPUTERS The computer has passed through many stages of evolution from the days of the mainframe computers to the era of microcomputers. Computers have been classified based on different criteria. In this unit, we shall classify computers based on three popular methods.

Categories of Computers Although there are no industry standards, computers are generally classified in the following ways:

Classification Based on Signal Type There are basically three types of electronic computers. These are the Digital, Analog and Hybrid computers.

The Digital Computer This represents its variables in the form of digits. The data it deals with, whether representing numbers, letters or other symbols, are converted into binary form on input to the computer. Digital computers are mostly used in commercial and business places.

The Analog Computer It measures rather than counts. Analog computers hold data in the form of physical variables rather than numerical quantities. It is used by scientists and engineers to solve systems of partial differential equations. It is also used in controlling and monitoring of systems in such areas as hydrodynamics and rocketry in production.

The Hybrid Computer In some cases, the computer user may wish to obtain the output from an analog computer as processed by a digital computer or vice versa. To achieve this, he set up a hybrid machine where the two are connected and the analog computer may be regarded as a peripheral of the digital computer. In such a situation, a hybrid system attempts to gain the advantage of both the digital and the analog elements in the same machine. This kind of machine is usually a special-purpose device which is built for a specific task. They are mainly used in aerospace and process control applications.

Classification by Purpose Depending on their flexibility in operation, computers are classified as either special purpose or general purpose.

Special-Purpose Computers A special purpose computer is one that is designed to solve a restricted class of problems. Such computers may even be designed and built to handle only one job. In such machines, the steps or operations that the computer follows may be built into the hardware. Most of the computers used for military purposes fall into this class. Other examples of special purpose computers include: . Computers designed specifically to solve navigational problems. . Computers designed for tracking airplanes or missiles . Computers used for process control applications in industries such as oil refinery, chemical manufacture, steel processing and power generation . Computers used as robots in factories like vehicle assembly plants and glass industries.

General Attributes of Special-Purpose Computers Special-purpose computers are usually very efficient for the tasks for which they are specially designed. They are very much less complex than the general-purpose computers. The simplicity of the circuiting stems from the fact that provision is made only for limited facilities. They are very much cheaper than the general-purpose type since they involve fewer components and are less complex.

General-Purpose Computers General-purpose computers are computers designed to handle a wide range of problems. Theoretically, a general-purpose computer can be adequate by means of some easily alterable instructions to handle any problems that can be solved by computation. In practice, however, there are limitations imposed by memory size, speed and the type of input/output devices. Examples of areas where general purpose computers are employed include the following: . Payroll . Banking . Billing . Sales analysis . Cost accounting . Manufacturing scheduling . Inventory control General Attributes of General-Purpose Computers . General-purpose computers are more flexible than special purpose computers. Thus, the former can handle a wide spectrum of problems. . They are less efficient than the special-purpose computers due to such problems as the following:  They have inadequate storage  low operating speed  Coordination of the various tasks and subsections may take time  General-purpose computers are more complex than special purpose computers.

FUNCTIONAL COMPONENTS OF A COMPUTER The functional components of a computer are broadly divided into two: . HARDWARE . SOFTWARE HARDWARE These include anything that can be seen and touched in the computer system. The hardware is made up of three components and they are A. The System Unit B. Peripheral Devices and C. Auxiliary Devices

The conceptual diagram of the computer hardware is as shown below in the figure below

Computer Hardware

Peripheral Central Processing Unit Auxilliary

Output Current Air Input Device UPS Transformer Device Stabiliser Conditioner

Arithmetic Control Unit Memory Logic Unit

Primary Secondary Tertiary

Read Only Random Access Memory Memory

Figure 2: Breakdown analysis of the hardware components of the computer

A. The System Unit The system unit which is referred to as the Central Processing Unit (CPU) and is composed of three units: i. Memory unit ii. Arithmetic-Logic unit and iii. Control unit i. Memory Unit The memory unit is that part of the computer where data and information are stored. The memory is generally divided into cells where each cell is capable of storing one and only one character. A cell is made up of eight bits, which is described as one byte. A bit is a placeholder of one and only one binary digit 0 or 1. A bit is 0 or 1. Also, a byte is the amount of store needed to hold one character. In other words, The standard unit of memory is a byte. A byte consists of 8 bits. The size of a Computer memory is measured in bytes (i.e., the working unit of memory is the byte). A byte contain one character, such as a letter, a “+” sign, a numerical digit or whatever. In measuring the size of a Computer’s memory you will often find or see the symbol K being used. This represents roughly a thousand, so that a Computer with a 640K memory contains about 640,000 bytes of RAM approximately. 1024 Bytes = 1 Kilobyte or simply 1K or 1KB 1024 KB = 1 Megabyte or 1M or 1MB 1024 MB = 1 Gigabyte or 1G or 1GB 1024 GB = 1 Terabyte or 1T or 1TB Computer memory is divided into . Primary . Secondary and . Tertiary Primary Memory The primary memory is directly connected to the CPU, has the highest speed but low output. The primary memory is classified into  Random Access Memory (RAM) and  Read Only Memory (ROM). RAM: The RAM is that part of the primary memory where computer users can store data temporarily while a program is being run. It is the work area of the computer consequently any information stored in the RAM at any point in time by a user is automatically erased or overwritten immediately the person closes up his data processing activities on the computer. The RAM is electric power dependent which means any program or data stored in it is lost when electricity supply is cut off (i.e. it is volatile). Illustration: The primary memory can be likened to a blackboard in a lecture room where information written on it is rubbed off by another lecturer. So, RAM allows the computer user to read and write on it.

ROM: ROM is the part of the primary memory, which is used by computer manufacturer to store some general purpose and permanent instructions such as utilities to start the computer. ROM as the name implies can only be read from but users cannot write into it; i.e. it is write- protected. Generally, the size of the ROM is considerably smaller than that of RAM. ROM retains its content when there is no electricity supply i.e. it is non-volatile.

Differences between ROM and RAM in a tabular form ROM RAM ROM is non-volatile RAM is volatile ROM is cheaper than RAM RAM is very expensive The contents of ROM are always known The contents are not known and can be verified ROM cannot be updated or corrected RAM can be updated and corrected ROM serves as permanent data storage RAM can serve as temporary data storage (Other differences can be added in tabular format)

Secondary Memory The secondary memory is not directly connected to the processor but is inside the system unit. The storage capacity of secondary memory is higher than the primary memory but its speed is lower. The secondary memory holds its contents as long as the user wants. The access time to information stored in secondary memory is much lower than the access time to information stored in primary memory. The most popular secondary memory is the hard disk. Basically a hard disk contains a non-removable disk, which is capable of storing large volume of data or information. It is large enough to be partitioned into two or more areas.

Tertiary Memory The tertiary memory is located outside the system unit and is not connected to the processor. Access time to information stored on tertiary memory is considerably lower than that of secondary memory. The motivations for tertiary memory are outlined below: 1. The secondary memory can be damaged by accident. A copy of stored data can be obtained if they have been replicated in a tertiary memory. 2. The need to transport stored data to another locality without moving the host computer. 3. The tertiary memory provides a cheap store for very large volume of data. Data stored on tertiary memory may be downloaded when the need arises for one to process. 4. There is a need to archive (backup) data and information for future references. 5. Data and information in general are local to users. Security and privacy of data may not be guaranteed on secondary memory. Confidential and secret data can therefore be stored on tertiary memory for safekeeping by the owner. 6. The host computer i.e. the computer being used for storing data in a secondary memory may develop fault. If the stored data has been recorded in a tertiary memory, one can copy the stored data from the tertiary memory onto the secondary memory of a working computer for processing.

Examples of tertiary memory are  Magnetic tape  Floppy disk  Compact disk read only memory (CD-ROM)   Flash drive  Memory card

(At leisure time, students are expected to check the Internet either through Google or other search engines to view images of the examples stated above)

Magnetic Tape Magnetic tape is widely used for mass storage of data. It supports sequential organisation of stored data and sequential processing of data i.e. data are stored in it one after the other in a sequence and are accessed one after the other. Magnetic tapes come in different sizes and recording densities. A magnetic tape is capable of supporting data transfer rates of about 96Kb per second. Data is recorded in magnetic tapes in blocks. A block is therefore the unit of data transfer and may be variable or fixed length type. The magnetic tape unit houses the read-write head that is similar to that of film projector in a film house.

Floppy Disk A floppy disk popularly called diskette is a tertiary memory used in microcomputer environment. Diskettes come in different sizes and the most popular ones are 5.25 inches type and 3.5 inches type. Their sizes that is, storage capacities ranges from 256 Kb to several million bytes. A diskette consists of two parts, outer jacket and the inner disk. Diskettes have varying number of tracks that is concentric rings on which data is stored or retrieved from. Tracks are divided into areas called sectors. Some diskettes come from the factory with predefined tracks and sectors and these are referred to as “hard sector diskettes”. On such diskettes are punched holes to show the beginning and end of each sector while diskettes without this are said to have soft sector and can be identified by having only one hole which is used by the computer as a reference or starting point. Compact Disk Read Only Memory CD-ROM is a plastic disk on which data are stored for retrieval by a laser beam of light instead of magnetic method.

Flash drive This is a card that stores computer information. It is a small plastic device functioning as a disk drive; containing memory chips that retain their contents without electrical power and that have a capacity of several gigabytes of data. On the end is a standard USB connector that fits into USB ports. ii. Arithmetic-Logic Unit The two major types of operations that can be performed on any data stored in the memory of computer are arithmetic and logic operations. The component of the computer system concerned with performing those operations is called the Arithmetic-Logic Unit (ALU). The arithmetic sub unit performs the normal operation of addition, subtraction, multiplication and division while the logic sub unit of the ALU provides the computer with the ability to test various conditions and take specific actions. The ALU includes registers, adders and counters. A register is capable of receiving data, holding data and transferring data as directed by the control unit. An adder receives data from two or more sources, performs the necessary arithmetic operations on the data and sends the results to a register. A counter counts the number of times an operation is performed. iii. Control Unit The control unit is the portion of the CPU that implements the program and automatically directs and coordinates all other units of the CPU. It directs the input devices to read data into the memory, it instructs the arithmetic-logic unit about what operations to perform on data stored in the memory and the place in the memory where results will be stored and instructs the output devices what information is to be printed. Control Unit has two main functions:-

 It controls the flow of information from one unit of the CPU to another unit so as to avoid unnecessary traffic hold up or jam.

 It guides and supervises each unit of the processor so as to ensure that each unit carries out every operation assigned to it at the appropriate time.

B. Peripheral Devices The devices through which one enters data into the computer memory and through which the computer communicates with users are external to the system unit hence they are described as peripherals. They are peripheral because they are not inside the system unit but are attached to the computer. Peripheral devices are classified into: . Input Devices and . Output devices

Input Devices * An input device is an electro-mechanical device through which data is entered into the computer memory. * They enable the computer to capture data or information from the user in the form of characters, figures, charts, diagrams, pictures, etc.

Input devices are designed to enable the user to interact with the computer. Examples of input devices are  Keyboard  Mouse  Trackball  Joystick  Light pen  Optical character reader  Magnetic ink character reader  Scanner  Microphone (Other examples can be given and further explained).a (At leisure time, students are expected to check the Internet either through Google or other search engines to view images of the examples stated above)

Keyboard This is the most widely used, common and familiar device. There are many types of keyboard and the standard one has four major divisions namely function keys, alphanumeric keys, numeric keys and control keys.

Mouse A mouse is a small input device that is held in the hand and contains a pointing device sensitive to movement. It has a roller ball and one or more buttons, which are pressed to make selections. The cursor moves whenever the mouse is moved.

Trackball This is another type of input device similar to the mouse. However, unlike the mouse, the roller ball is put in a fixed position. From that position, the device is made to spin in any direction to produce movement on the screen.

Joystick The joystick is a device, which is similar to the track ball except that the user pushes a single vertical stick to produce movements on the screen.

Light pen Light Pen is a pointing device in which the user holds a wand, which is attached to the computer, up to the screen and selects items or chooses commands on the screen either by pressing a clip on the side of the light pen or by pressing the light pen against the surface of the screen. The wand contains light sensors and sends a signal to the computer whenever it records a light, as during close contact with the screen when the non-black pixels beneath the wand's tip are refreshed by the display's electron beam.

Optical Character Reader The optical character reader (OCR) is a device used to scan bar codes on most manufactured products. Bar codes may consist of various sizes of light and dark line, which are easily decoded when they come in contact with reflected light patterns from OCR, which are used to scan the bar codes. The codes are then decoded and converted into electrical pulses and switches and transmitted onto the computer screen. The output on the screen provides information that is used to compare the already programmed patterns to find out the similarities and differences. OCR are used in retail and other points of sale, marketing outlets, service points in libraries, production processes to detect the quality of manufactured products. Also it is used by examination bodies like WAEC to scan multiple choice answer sheets, completed mark sheets and examination entry forms.

Magnetic Ink Character Reader (MICR) This is a character reader sorting device mostly used by banks to process cheques. Specially designed font characters are printed on the cheque in magnetic ink. When the cheque is fed into the device, the MICR converts the customer’s particulars printed in magnetic ink on the cheque into electrical pulses which the computer transmit to the screen for further actions.

Scanner A scanner is a device for examining an object in detail in order to produce an electronic image of it, using visible light or another form of electromagnetic radiation such as a laser.

Microphone Microphone is a device used to transform sound energy into electrical energy. Microphones are important in many kinds of communications systems and in instruments that measure sound and noise. The American inventor Alexander Graham Bell built the first microphone in 1876 when he constructed his telephone transmitter. The simplest type of modern microphone is the carbon microphone, used in telephones.

Output Devices * An output device is a device through which the computer communicates to the user. The results obtained from processing of data are often stored in the memory. The results may either be directed to the printer to produce a hard copy or to the visual display unit to produce a soft copy. Hard copies are permanent form of output reports, which usually refer to the recording of letters, graphics or pictures on a hard medium such as paper or film for either storage or read immediately. Hard copy outputs are more expensive than soft copy output reports since they require the use of paper and either ink cartridge, toner cartridge or ribbon. Hard copies have the advantage of portability because they can be detached from the output device and carried or moved around. Soft copies are temporary form of output reports, usually displayed on the VDU. They provide immediate access to information. They are lost when the program is cancelled or the computer is switched off. Output reports are normally in the form of a text, count of words, numbers and other symbols in the form of a language or images in the form of graphics or pictures.

Examples of output devices are  Printer  Plotter  Monitor  Speaker

(Other examples can be given and further explained)

Printer This is a very common output device attached to the computer, which transfer information from the computer into paper copy. There are many types of printers and they can be broadly classified into impact and non- impact printers. Impact printers physically strike the paper and examples are the pin dot-matrix printers and daisy-wheel printers. Non-impact printers include every other type of print mechanism, including laser, ink-jet, and thermal printers. Plotter A computer plotter is a kind of printer that is capable of producing designs, graphic works, drawings and pictures in colour on hard copy. However, with the introduction of colour printers and graphic packages, in the computer market in recent times, the use of plotter is becoming less important.

Monitor A monitor or visual display unit (VDU) is a television like device used for displaying the results obtained from a data processing activity in the form of data or information. It is the commonest device today through, which the computer communicates with the user. It can be coloured or monochrome. A colour monitor can produce output in several colours while monochrome display output in a single colour, usually green or amber on a black background. The popular monitors are the 12 inches, 14 inches and also dedicated desktop publishing microcomputer such as Apple Macintosh, these are some which are well over 20 inches size. Monitors are made up of 80 columns and 24 rows i.e. there are 80 text positions (columns) on each line and there are 24 lines on a typical screen.  Flat-Panel Display The flat panel display does not have a picture tube like the monitors. It offers lightweight, less bulky and lower power consumption than monitors. One form of flat panel display is the Liquid Crystal Display (LCD). That consumes very low power. They are the most cost effective displays for portable battery powered computers like laptops and palm tops. One advantage of LCD is that the display object may not be very bright therefore users need to strain their eyes before they can read the contents of the display.

Speaker A speaker is an electronic or electromagnetic device used to convert electrical energy into sound energy, providing audible sounds.

C. Auxiliary Devices Auxiliary hardware consists of equipment that facilitates the use of computer and makes the environment suitable for efficiency and effectiveness. It also increases the life span of the system.

Examples of auxiliary hardware and their uses are:

 Uninterruptible Power System (UPS): It has the ability to regulate power going in and out of the system and to store current for use when there is no power supply.

 Stabilizer: This is used to regulate the voltage going in and out of the system. It also stabilizes the current going into the system and prevents power surge.

 Transformer: This is to ensure adequate supply of electricity to the system. It is a device for changing electrical energy from one alternating circuit to another.

 Air conditioner: Air conditioner is a device for cooling and controlling the humidity and purity of the air circulating in a space. It makes the environment comfortable for the user.

SOFTWARE Software is a set of instructions or programs given to the computer to carry out certain functions. It refers to all programs that are run on a computer. A program is a set of instructions meant to solve a specific problem. The two main types of software are: . System software and . Application software

System software Systems Software are applications or programs that are designed specifically for running the hardware on a personal computer and are used to maintain a platform for Application Software to be used. This means that systems software is designed to communicate with the internal parts of your computer such as the hard drive, RAM, ROM, cache, microprocessors, etc. so that the user doesn't have to. It contains all of the drivers necessary for this type of communication, and, in the simplest sense, it is the interface between the user and the hardware. System software is made up of: . Operating system . Program translators and . Utility programs

Operating System An Operating System is a collection of programs that manages resources of a computer, such as processors, memory, input/output devices and so on. It is the most important and fundamental software that controls a computer. It is a software program that empowers the computer hardware to communicate and operate with the computer software. The operating system serves as a link between the hardware and software and between the hardware and the user. An operating system controls the flow of programs and data through the computer, controls input and output devices and manages the memory of the computer. The operating system has three major functions: . It coordinates and manipulates computer hardware, such as computer memory, printers, disks, keyboard, mouse, and monitor; . It organizes files on a variety of storage media, such as floppy disk, hard drive, compact disc, digital video disc, and tape; and . It manages hardware errors and the loss of data. Examples of operating system are:  MS-DOS (Microsoft Disk Operating System)  UNIX  Linux  Mac OS  Windows Operating Systems for Mobile Phones: There are many different operating systems for mobile phones and devices but most six stands out as being most used. These are Android, Asha, Blackberry, iOS, Windows Phone, and Windows RT.

Program Translators Program translators are programs specially written for the purpose of translating programs written in other computer languages to machine language. It functions just like human translator – it translates to what computer can understand and translates back to the user in the way the user can understand too. Program translators perform the following functions: a. Conversion of source code to (normal program instructions) to object codes (machine language “0” and “1”). b. Checking of syntax errors in programs. c. Resolving any ambiguous or conflicting instructions in the program. d. Optimising program instructions so as to save input/output time.

Types of Translators: Assemblers: These are used to translate into machine codes. Assembly language makes use of mnemonics (designed to aid memory) and is therefore called symbolic language. Compilers: These translate an entire source code program in high-level language into machine codes. Translation is done in a single pass, or batch operation. Examples of high-level languages that are available as compiler implementations include: COBOL, , PASCAL, C#, C++, JAVA, etc. Interpreters: These translate instructions written in a high-level language into machine code that the computer can understand. Here, translation takes place during processing and continues line by line, one program statement at a time unlike the compiler in which the entire source code program is translated at once. An example is BASIC programming language.

Utility Software These are programs written to carry out common tasks of a routine nature. They are also known as service programs. Utility software is provided by computer manufacturers and other specialist software houses. Some of them are; Driver: a program that controls a device. There are device drivers for printers, displays, CD- ROM readers, diskette drives, and so on. For other devices, you may need to install a new driver when you connect the device to your computer. A driver acts like a translator between the device and programs that use the device. Each device has its own set of specialized commands that only its driver knows. Computer virus: a program that can destroy and corrupt data on a computer. It can come through a floppy disk, CD, or USB, but now usually comes through email. Virus is a program that can copy themselves and create problems in one computer without the user ever knowing or authorizing it. Virus can only be spread when they are taken to an uninfected computer. Viruses are commonly confused with computer worms and Trojan horses. A worm has the capabilities to spread itself to other computers without needing to be transferred as part of a host. Trojan horses are files that appear to be harmless until they are executed. Antivirus software: a computer program that attempts to identify and eliminate computer viruses. There are two different techniques to accomplish this, examining (scanning) and identifying suspicious behavior. An example of an antivirus software program is Norton antivirus. Norton antivirus (NAV) is a popular product of Symantec Corporation and is one of the most widely used antivirus programs.

Boot Code: Boot code is used to create a working environment for the operating system. The term, "boot" is a shortening of the term, "bootstrapping" which answers the problem of a computer needing it to be in a running state in order to start itself. A very small program, the code examines the system hardware; initializes environment variables such as date, time and device start order; identifies and starts the internal peripheral devices the computer uses, such as hard drives and video processors; enables the various communication ports and executes the operating system.

Application Software Application software consists of programs written in any computer programming language by a programmer to carry out specific task for the user. Some of the most popular examples include: . Word processors . Spread sheets . Photo-editing programs . Database programs, and . Accounting programs Application Software tends to perform useful tasks which are not associated with computer maintenance, system boot-up, or hardware communication. Application software is directly reliant on the Systems Software to communicate to the physical components of the computer and cannot operate without it. To visualize this, the Application Software would operate on top of the Systems Software and would be the most visible to the user while the Systems Software would remain in the background unnoticed. The Systems Software would then communicate to the Hardware on its behalf and deliver any information to it from the Application Software.

In turn, any information needed from the Hardware would pass through the Systems Software to the Application Software.

Software Package A software package is a set of related programs prepared by a computer software company like Microsoft, Novell, etc. for the purpose of carrying out common tasks that are usually carried out by experts of a given program. A business application package is a complete suite of programs and its associated documentation that covers a business routine. It is usually available from a computer manufacturer or software home, bureau, etc. on lease or outright purchase. A software package is usually intended to meet the needs of a particular industry and the companies in the industries. In order to achieve this objective, most packages are of modular design and therefore can be designed on a building-block principle to cater for the individual company needs of the user. Examples are packages dedicated to some specific organizations such as insurance companies, banks, stockbrokers, local governments, etc

PROGRAM DEVELOPMENT

Problem Solving With the Computer The computer is a general-purpose machine with a remarkable ability to process information. It has many capabilities, and its specific function at any particular time is determined by the user. This depends on the program loaded into the computer memory being utilised by the user. There are many types of computer programs. However, the programs designed to convert the general-purpose computer into a tool for a specific task or applications are called “Application programs”. These are developed by users to solve their peculiar data processing problems.

Computer programming is the act of writing a program which a computer can execute to produce the desired result. A program is a series of instructions assembled to enable the computer to carry out a specified procedure. A computer program is the sequence of simple instructions into which a given problem is reduced and which is in a form the computer can understand, either directly or after interpretation.

Principles of Good Programming It is generally accepted that a good computer program should have the characteristics shown below: 1. Accuracy: The program must do what it is supposed to do correctly and must meet the criteria laid down in its specification. 2. Reliability: The program must always do what it is supposed to do, and never crash. 3. Efficiency: Optimal utilisation of resources is essential. The program must use the available storage space and other resources in such as way that the system speed is not wasted. 4. Robustness: The program should cope with invalid data and not stop without an indication of the cause of the source of error. 5. Usability: The program must be easy enough to use and be well documented. 6. Maintainability: The program must be easy to amend, having good structuring and documentation. 7. Readability: The code of a program must be well laid out and explained with comments. 8. Modularity: It is desired that a very large program be broken down into a series of sub- tasks and it is a good programming practice to implement each of those sub-tasks as a separate module. The use of module programming structure enhances the accuracy and clarity of a program and facilitates future program alteration.

STEPS INVOLVED IN PROGRAM DEVELOPMENT

The preparation of a computer program involves a set of procedure. These steps can be classified as follows:

Step 1: Problem Definition and Analysis In defining a given problem, all the necessary data are gathered; one should be able to answer the following questions very well: . Can the problem be solved by a computer? . What are the problem’s objectives? . What are the required input data? . What is the desired output? Step 2: Provide Solution to the Given Problem This involve finding the processing required to obtain the expected result from the given data. Step 3: Program Design This is concerned with the sequence or order in which the problem will be solved. It involves breaking down of the whole problem into smaller units called program modules. Step 4: Flow Chart Vetting/Desk Checking The program designed should be properly desk checked to locate and correct errors before proceeding to the next step. Step 5: Program Coding This is the translation of the flowchart or algorithm into the computer programming language to be used and thus building up a complete computer program. Step 6: Program Translator The program written in high level language is submitted to computer for compilation, interpretation or translation). The translation is done by either a compiler or an interpreter depending on the program language. Its function is to check for the syntactic and semantic correctness of the program. If the source programs is syntactically and semantically correct it is converted to the machine language (object program). However, if it contains syntax error, error message is displayed. Step 7: Program Testing and Debugging Here, the program can be tested with the data collected. If errors are found in the program they must be corrected and the program re-tested until it is error free. * Debugging is the act of locating and correcting errors in a program. Step 8: Program Documentation After the program has been tested and completely debugged, it should be collected and kept safely for future maintenance purpose.

FLOW CHARTS AND ALGORITHMS

A typical programming task can be divided into 2 phases: 1. Problem solving phase . Produce an ordered sequence of steps that describe solution of problem . This sequence of steps is called an algorithm 2. Implementation phase . Implement the program in some programming language

FLOWCHARTS A flowchart is the diagrammatic or pictorial representation of a solution to a given problem. It displays in separate boxes the essential steps of the program and shows by means of arrows the directions of information flow. The boxes, most often referred to as illustrative symbols, may represent documents, machines or actions taken during the process. The area of concentration is on where or who does what, rather than on how it is done. A flowchart can also be said to be a graphical representation of an algorithm, that is, it is a visual picture which gives the steps of an algorithm and also the flow of control between the various steps.

Flowchart Symbols Flowcharts are drawn with the help of symbols. The following are the most commonly used flowchart symbols and their functions:

1. Start / end symbol

It can also be regarded as the Start / Stop symbol. A program flowchart has one start and one end symbol.

2. Process symbol

The shape took the form of a rectangle. This is used to indicate operation involving arithmetic’s computation and moving data from one area of the memory to another, read, print and so on.

3. Decision or condition symbol

This is used when some comparisons are being made and some conditions are established.

4. Connector symbol

This is a symbol used to show where one part of a flowchart connects to another by drawing a connecting line to show the flow. They are used for example when a flowchart gives off the end of the page and is continued on the next page.

5. Input / Output symbol

The shape took the form of a parallelogram. This is used to indicate the input/output operation in a flowchart. It is used to indicate the procedure for supplying input data into the computer.

6. Arrow symbol

It indicates the direction of logical flow of the program. The arrow can point to the right, left, up or down.

Flowchart Drawing Rules Important rules and guidelines used for drawing flowcharts are: . Only conventional flowchart symbols should be used. . Arrows can be used to indicate the flow of control in the problem. However, flow lines should not cross each other. . Processing logic should flow from top to bottom and from left to right. . Words in the flowchart symbols should be common statements and easy to understand. These should be independent of programming languages. . Be consistent in using names and variables in the flowchart. . If the flowchart becomes large and complex then connector symbols should be used to avoid crossing of flow lines. . Properly labelled connectors should be used to link the portions of the flowchart on different pages. . Flowcharts should have start and stop points.

Flowcharting the Problem The digital computer does not do any thinking and cannot make unplanned decisions. Every step of the problem has to be taken care of by the program. A problem which can be solved by a digital computer need not be described by an exact mathematical equation, but it does need a certain set of rules that the computer can follow. If a problem needs intuition or guessing, or is so badly defined that it is hard to put into words, the computer cannot solve it. You have to define the problem and set it up for the computer in such a way that every possible alternative is taken care of. A typical flowchart consists of special boxes, in which are written the activities or operations for the solution of the problem. The boxes, linked by means of arrows, show the sequence of operations. The flowchart acts as an aid to the programmer, who follows the flowchart design to write his programs.

Advantages of Flowcharts The various advantages of flowcharts are as follows: 1. Synthesis: Flowcharts are used as working models in designing new programs and software systems. 2. Documentation: Program documentation consists of activities, such as collecting, organizing, storing, and maintaining all related records of a program. 3. Coding: Flowcharts guide the programmer in writing the actual code in a high-level language, which is supposed to give an error-free program developed expeditiously. 4. Debugging: The errors in a program are detected only after its execution on a computer. These errors are called bugs and the process of removing these errors is called debugging. In the debugging process, a flowchart acts as an important tool in detecting, locating, and removing bugs from a program. 5. Communication: A flowchart is a pictorial representation of a program. Therefore, it is an excellent communication technique to explain the logic of a program to other programmers/people. 6. Analysis: Effective analysis of a logical problem can be easily done with the help of a related flowchart. 7. Testing: A flowchart is an important tool in the hands of a programmer, which helps him in designing the test data for systematic testing of programs.

ALGORITHMS Before a computer can be put to any meaningful use, the user must be able to come out with or define a unit sequence of operations or activities (logically ordered) which gives an unambiguous method of solving a problem or finding out that no solution exists. Such a set of operations is known as an ALGORITHM.

An algorithm is a finite step-by-step procedure to achieve a required result. Also, an algorithm can be defined as a sequence of computational steps that transform the input into the output. An algorithm must necessarily comply with the following basic criteria: 1. It must have the start and stop steps in its procedure i.e. it must be finite. 2. It must have a clear and unambiguous define steps. 3. It must have its set of input data. 4. It must generate result which must be accurate and effective.

PSEUDOCODES A pseudocode is a program design aid that serves the function of a flowchart in expressing the detailed logic of a program. Sometimes a program flowchart might be inadequate for expressing the control flow and logic of a program. By using Pseudocodes, program algorithms can be expressed as English-language statements. These statements can be used both as a guide when coding the program in a specific language and as documentation for review by others. Because there is no rigid rule for constructing pseudocodes, the logic of the program can be expressed in a manner that does not conform to any particular programming language. A series of structured words is used to express the major program functions. These structured words are the basis for writing programs using a technical term called “structure programming”

Exercise 1: Write an algorithm and draw a flowchart to add two numbers 10 and 12 together. Exercise 2: Write an algorithm and draw a flowchart to compute the average of three given numbers 10, 20 and 30. NOTE: These exercises will be treated in class.

INTRODUCTION TO BASIC (Beginner’s All-purpose Symbolic Instruction Code) PROGRAMMING LANGUAGE The BASIC programming language was developed in 1965 by John G. Kemeny and Thomas E. Kurtz as a language for introductory courses in computer science.

Basic is a very powerful language as a tool for the novice programmer.

Basic allows for a wide range of applications, and it has many versions. Areas of Application Basic has many strong points, such as:  It is easy to learn for beginners

 It adds powerful additional features for the advanced user

 It is designed for interactive use.

 It is therefore suitable for both the professional and non-professional.

LET, PRINT, and END are keywords

Keywords are words that are part of a programming language that cannot be redefined and are given in upper case.

True BASIC does not distinguish between integer numerical variables and floating point numerical variables and recognizes only two types of data: numbers and strings (characters).

The first character of a variable must be a letter and the last must not be an underscore.

The PRINT statement displays output on the screen.

The last statement of the program must be END. Basic Commands The END Command: This command is typed at the point where you wish your program to end.

DATA The two data types: Data in Basic is stored in CONSTANTS and VARIABLES. Question: Distinguish between a constant and a variable in the running of BASIC programs. CONSTANTS are data that never changes, i.e. remains constant, While VARIABLES contain data that have the ability to be changed, i.e. vary.

The CONSTANTS: Constants are simply values that never change. For example, in one part of your program you may have the following: PRINT "Please enter your name:" Well, everything enclosed in those quotes is a constant. It never changes. Constants, therefore, are data that never changes. It is the same every time the program is run. That statement will always be printed like that, it never changes. Another example of how to declare a constant is shown below: CONST PI = 3.141593

The VARIABLES: Variables contain data that has the ability to change during the course of the program. Here are rules to what variable names can be. 1. Variable names cannot begin with a number ('1num'is not a valid variable name while 'num1' is). 2. Variable names can only include letters and periods (special characters used in identifying the TYPE of the variable are allowed, but only at the end of the name). 3. Variable names CANNOT include spaces. 4. Variable names CANNOT be the name of a QBasic command. You CANNOT have a variable name called PRINT, CLS, END, etc.

To declare a variable, use the DIM command, like so: DIM var To declare multiple variables, seperate their names by commas: DIM var1, var2, var3

There are two main types of variables, those that store numerical values (51, 893.5, 0.005, etc.) and those that store text ("Hello World", "A", "Neil Obremski", etc.). The two main types of variables are: Numerical variables String variables Variables that store text are called strings, because they store a string of characters, and in memory they use a string of bytes to store each character.

String Variables: For example A = "This is my string" PRINT A

Numerical Variables: There are more than one variable types that store numerical data. In a technical list we have integers, long integers, single precision floats, and double precision floats. Integers can only store whole numbers (LIKE: 7, 28, 195 / NOT: 1.5, 30.832, 38.2), while floats can store decimal values. The following is a list of the keyword to use to 'DIM' each at the beginning of the program:

INTEGER - Integer LONG - Long Integer SINGLE - Single Precision Float DOUBLE - Double Precision Float

OPERATORS Operators – basically *, /, +, - , usually evaluated in that order, except parenthesis is used. EXPRESSIONS Expressions in BASIC are like mathematical formulas, formed by combining variables and numbers together with arithmetic operators and parenthesis. Usually, expressions are passed to a variable, e. g. a = pi*r^2

METHODS OF GETTING DATA INPUT 1. From the user: Here, data can be typed in by the user, upon running the program. Examples; INPUT X PRINT “You typed”, X Another example is INPUT myname$, age, sex$ PRINT "MY NAME IS", myname$ PRINT "I am", age, "years old" PRINT "I am a ", sex$

2. From the program: Here, the data can be typed in with the program. Example READ A1, A2, A3 DATA 23,34,45

3. From file: Here, the file must be already existing. Example; OPEN "testfile.dat" FOR INPUT AS #1 INPUT #1, text$ CLOSE #1 PRINT text$

OUTPUT The PRINT command is the means of output. However, output can either be to the screen or to a file. - Output to the screen is simply by using the PRINT command. In addition, using comma leaves a tab space, while semicolon leaves no space, e.g. the program below, INPUT myname$, age, sex$ PRINT "MY NAME IS", myname$ PRINT "I am", age, "years old" PRINT "I am a ", sex$ Gives the output ?Bukola ??20 ???female MY NAME IS Bukola I am 20 years old I am a female