Download presentation
Presentation is loading. Please wait.
Published byCory Russell Modified over 9 years ago
1
CPSC- 120 Principle of Computer Science I Computer = Hardware + Software
2
Hardware b Main Memory b Secondary Memory b Central Processing Unit (CPU) b Input Devises b Output Devises
3
Main Memory b Random Access Memory (RAM) b storing information and programs b information such as numbers, names, lists, pictures b An ordered sequence of storage locations called memory cell b each memory cell has associated with it a unique address
4
Secondary Memory b Additional storage capability on most computer such as a disk drive b hard disk, floppy disk, CD b inexpensive b more information can be stored measured by megabyte or gigabytes
5
Central Processing Unit (CPU) b Control computer operations b Perform arithmetic and logical operations b each operation is performed less than one millionth of a second b To process a program, CPU fetches each instructionfetches each instruction decodes the instructiondecodes the instruction executes the instructionexecutes the instruction
6
Input and Output Devices b Output Monitor, PrinterMonitor, Printer b Input Keyboard, MouseKeyboard, Mouse
7
Software b Operating Systems- - UNIX, Windows b Application Programs - - Word Processor, Spreadsheet b Software Development Tools - - compiler, editor
8
Steps in the Software Development Method b Problem Specification b Analysis b Design b Test Plan b Implementation or coding b Testing
9
Case Study b Refer to page 21
10
Programming languages b Machine Languages b Assembly Languages b High-Level Languages
11
WITH Ada.Text_IO; PRODECURE Hello IS -------------------------------------------------------------------- -- A very simple program; it is just displays a greeting. -- -- ---------------------------------------------------------------- BEGIN -- Hello Ada.Text_IO.Put(Item => “Hello there. “); Ada.Text_IO.Put(Item => “We hope you enjoy studying Ada!”); Ada.Text_IO.New_Line; END Hello; Example Ada Program
12
Chapter 3 The General Structure of Ada Programs
13
Displaying Initials Program WITH Ada.Text_IO; PROCEDURE Hello_Initials IS ------------------------------------------------------------ --| Requests, then displays, user's first and last initials. --| ------------------------------------------------------------ Initial1 : Character; -- objects that hold initials Initial2 : Character;
14
Cont. BEGIN -- Hello_Initials -- Prompt for (request user to enter) user's initials Ada.Text_IO.Put(Item => "Enter your two initials> "); Ada.Text_IO.Get(Item => Initial1); Ada.Text_IO.Get(Item => Initial2); -- Display user's initials, with a greeting Ada.Text_IO.Put(Item => "Hello "); Ada.Text_IO.Put(Item => Initial1); Ada.Text_IO.Put(Item => Initial2); Ada.Text_IO.Put(Item => ". Enjoy studying Ada!"); Ada.Text_IO.New_Line; END Hello_Initials;
15
Reserve Words and Identifiers b Reserve Words WithProcedureISBeginEND
16
b Predefined Identifiers Ada.Text_IOPutNew_LineCharacterGet
17
Displaying the User’s Name WITH Ada.Text_IO; PROCEDURE Hello_Name IS ------------------------------------------------------------------------ --| Requests, then displays, user's name --| ------------------------------------------------------------------------ FirstName: String(1..10); -- object to hold user's name
18
Cont. BEGIN -- Hello_Name -- Prompt for (request user to enter) user's name Ada.Text_IO.Put (Item => "Enter your first name, exactly 10 letters."); Ada.Text_IO.New_Line; Ada.Text_IO.Put (Item => "Add spaces at the end if it's shorter.> "); Ada.Text_IO.Get(Item => FirstName); -- Display the entered name, with a greeting Ada.Text_IO.Put(Item => "Hello "); Ada.Text_IO.Put(Item => FirstName); Ada.Text_IO.Put(Item => ". Enjoy studying Ada!"); Ada.Text_IO.New_Line; END Hello_Name;
19
Ada’s Capabilities b Control Structures b Data Structures b System Structures
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.