Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Flipp Book Class-7

Flipp Book Class-7

Published by Memorica Graphics, 2021-03-11 08:35:53

Description: Flipp Book Class-7

Search

Read the Text Version

Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... g. What do you mean by saving document? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... FORMATTING DOCUMENT Formatting refers to change the appear- ance of the document, paragraph and object of document. The control panel allows to perform the formatting task. You are getting varieties of formatting attributes in the control panel. The attri- butes of control panels are varies base on Type Tool and other selection Tool. How to Active Control Panel: Steps to Follow: Step-1 : Click on 'Window' menu. Step-2 : Click 'Control' option. By default, it is selected. or Step-2 : Press Alt+Ctrl6. Character Formatting Character formatting refers to change the appearance of only selected text. It does not make any effect to the paragraph or whole document. The character formatting includes the varieties of attributes. The common attributes are as: a. Font Style and size b. Basic style of character (Bold, Italic, Black, etc.) c. Kerning d. Vertical Space Smart Computer Science Book-7 195

e. Base line Shift f. Leading Space g. Tracking h. Horizontal Scale i. Skew Steps to Follow: Step-1 : Click on 'Type' menu. Step-2 : Click 'Character' option. Step-3 : Now, you get the character panel as given in picture. Step-4 : Select the text and change the attributes from the character panel as you like. Same attributed can be also applied from the control panel. Paragraph Formatting Paragraph formatting refers to change appearance of a specific paragraph. It makes effect whole paragraph in which courser is placed. The paragraph formatting includes the following common at- tributes: a. Alignment of paragraph text. b. Indentation c. Paragraph spacing (Space After/Before) d. Drop Cap e. Border and Shading Steps to Follow: Step-1 : Click on 'Type' menu. Step-2 : Click 'Paragraph' option. Step-3 : Now, you get the Paragraph panel as giv- en in picture. Step-4 : Select the paragraph and change the attributes from the character panel as you like. Same attributed can be also applied from the control panel. Apply color Applying colors to paths, frames, and text is a common publishing task, whether you’re publishing in print or exporting to the web. When applying 196 Page Layout with InDesign

color, keep in mind the final medium in which the artwork will be published so that you can apply color using the most appropriate color mode. Adobe InDesign provides a number of tools for applying color, including the Toolbox, the Swatches panel, the Color panel, the Color Picker,etc. When you apply a color, you can specify whether the color applies to the stroke or fill up an object. Steps to Follow Step-1 : Select the object you want to color by selecting se- lection and direct selection Toll for Object and Type Tool for text. Step-2 : In the Toolbox or in the Color or Swatches panel, select the For- matting Affects Text or Format- ting Affects Container to determine whether color is applied to the text or the text frame. Step-3 : In the Toolbox or in the Color or Swatches panel, select the Fill box or the Stroke box to specify the fill or stroke of the object. (If you selected an im- age, the Stroke box has no effect.) step-4 : Open color picker, Color panel, swatch panel and select desire color Step-5 : Click 'Ok' button,if you are using Color picker dialog box. Smart Computer Science Book-7 197

Lab Activities 1. Activate the Control panel and hov- er the mouse pointer in each com- ponents of control panel and get the knowledge about the name and function of each component. 2. Activate the Character panel and Paragraph Panel and hover the mouse pointer in each components of Character panel and get the knowl- edge about the name and function of each component. 3. Open your previous saved document, format as given below and save in same document name. 198 Page Layout with InDesign

Review Knowledge 1. Answer the following questions: a. Differentiate between Paragraph formatting and Character formatting. Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………………………………………………………………………………………… ………………………………............................................................................... .......................................................................................................................... b. What do you mean by leading ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... c. What do you mean by space after and before ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... d. What do you mean by drop cap ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... e. What do you mean by indent ? Smart Computer Science Book-7 199

Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... f. What do you mean by left and right indent ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... g. Differentiate between first line left indent and last line right indent. Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... h. What do you mean by leading ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... i. What do you mean by Alignment? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………........................................................................................................................ j. How many types of alignment are supported by InDesign ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… 200 Page Layout with InDesign

………............................................................................................................... k. Differentiate between superscript and subscript ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... l. When do you use strike through ? Ans:…………………………………………………………………………………… ………………………………………………………………………………………… ………............................................................................................................... PLACING THE OBJECT The Place command is the primary method used to import graphics into InDe- sign. It provides the highest level of support for resolution, file formats, multi page PDF and INDD files, and color. Steps to Follow: Step-1 : Click on 'File'. Step-2 : Select 'Place' option and click on it. Step-3 : Find drive and folder (loca- tion) of file. Step-4 : Select image. Step-5 : Click on 'Open'. Step-6 : You notice that image is coming with mouse pointer. Step-7 : Move pointer towards where you place your image. Step-8 : Click the mouse pointer once. Smart Computer Science Book-7 201

Step-9 : Now, you notice that image is placed. RE-SIZING THE OBJECT: Step-1 : Select an image using Move Tool Step-2 : Hold down the Ctrl+Shift key and Click the selection handle and drag the mouse pointer until the object be- comes in desire size. Then release the mouse pointer. WRAP TEXT AROUND OBJECTS Text Warp is a feature which allows to wrap the text around any object, includ- ing text frames, imported images, and objects you draw in InDesign. When you apply a text wrap to an object, InDesign creates a boundary around the object that repels text. The object that text wraps around is called the wrap object. Keep in mind that text wrap options apply to the object being wrapped, not the text itself. Steps to Follow: Step-1 : Move you image to the text where image is wrapped. Step-2 : Click in 'Window' menu. Step-3 : Select 'Text Wrap' and click on it. You get the text warp window. Step-4 : Click 'Wrap around bounding box'. Step-5 : Increase the offset value by click- ing on up arrow key of offset icon to maintain the space between image and text. Step-6 : You can move your image for proper placement using 'Move Tool'. Step-7 : You can increase/decrease image size using direct selection tool. 202 Page Layout with InDesign

Wrap Around Bounding Box : Creates a rectangular wrap whose width and height are determined by the bounding box of the selected object, including any offset distances you specify. Wrap Around Object Shape : Also known as contour wrapping, creates a text wrap boundary that is the same shape as the frame you’ve selected (plus or minus any offset distances you specify). Jump Object : Keeps text from appearing in any available space to the right or left of the frame. Jump To Next Column : Forces the surrounding paragraph to the top of the next column or text frame. SET STROKES You can apply strokes, or line settings, to paths, shapes, text frames, and text outlines. The Stroke panel provides control over the weight and appearance of the stroke, including how seg- ments join, start and end shapes, and options for corners. You can also select stroke settings in the Control panel when a path or frame is selected. Steps to Follow: Step-1 : Select the path whose stroke you want to modify. Step-2 : Click on 'Window'. Step-3 : Select 'Stroke' option and click on it. You get stroke dialog box. Step-4 : Select the 'weight' of stroke by clicking on drop down button of 'Weight'. Step-5 : Set other required parameters for the stroke. Such as Type, Start, End, etc. Smart Computer Science Book-7 203

Step-6 : To apply the stroke color. You can use Swatch panel, Color Panel or Color Picker dialog box, etc. Lab Activities 1. Open your previous saved docu- ment, edit the heading, place the object, format with Text Wrapping with object feature, apply the stroke as given below and save in same document name. 204 Page Layout with InDesign

BULLET AND NUMBERING LIST Bullet List is known as the unordered list which begins with bullet characters. Number List is known as ordered list which begins with an expression that includes a number or letter and a separator such as a period or parenthesis. The numbers in a numbered list are updated automatically when you add or remove paragraphs in the list. Steps to Follow: Step-1 : Select your Text where you want to apply bullet. Step-2 : Click on 'Type' menu. Step-3 : Click the arrow head of 'Bul- leted & Num- bered List'. Step-4 : Select and click 'Apply Bullets'. Setp-5 : Set the Indentation and Tab position. Lab Activities 1. Create new document, type the text and format as given below with bullet list. Smart Computer Science Book-7 205

Review Knowledge 1. Answer the following questions: a. Differentiate between Bullet List and Number List. Ans: ................................................................................................................. .......................................................................................................................... .......................................................................................................................... .......................................................................................................................... b. What do you mean by text wrap ? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... c. When do you use 'Wrap around bounding box' ? Ans: ................................................................................................................. .......................................................................................................................... .......................................................................................................................... d. Where do you find Text wrap Panel ? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... e. Why do you use offset value with Text Wrap? Ans: ................................................................................................................. 206 Page Layout with InDesign

.......................................................................................................................... .......................................................................................................................... f. Which command do you use to place the image in the InDesign document ? Where do you find it? Ans: ................................................................................................................. .......................................................................................................................... ......................................................................................................................... g. What do you mean by stroke ? Ans: ................................................................................................................. ......................................................................................................................... ......................................................................................................................... h. What do you mean by weight of stroke ? How do you define it? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... DRAWING BASIC SHAPES AND LINE InDesign supports to draw shapes, line and change the path of shape automatically. You can draw line and shapes using some Tools from Tool box, such as Pencil Tool, Line Tool, Shapes Tools like polygo- nal, rectangle,etc. Steps to Follow: Step-1 : Select Drawing Shape Tool from the Tool Box. Step-2 : Move your Mouse Pointer towards the work area. Smart Computer Science Book-7 207

Step-3 : Click and drag the mouse. Step-4 : Set the color and stroke parameters. Step-5 : Fill the color to shape, if you need using Color picker, Swatch, etc. TYPE ON THE PATH InDesign support to type text along with edge of path of any shape. Using this feature you can create your varieties of artistic design of Text. Steps to Follow: Step-1 : Create any path using Drawing Tool Step-2 : Select 'Type on a Path Tool'. Step-3 : Click on the desire place of path of the object. Step-4 : Start to Type Text. Step-5 : Format the text using formatting parameters. Step-6 : you may hide the object by applying white color to stroke of object. Step-7 : Now, you get your text as the object. SPECIFY POLYGON SETTINGS Steps to Follow: Step-1 : Double-click the Polygon tool , specify the following settings, and click OK: Step-2 : For Number of Sides, type a value for the number of sides you want for the polygon. Step-3 : For Star Inset, type a per- centage value to specify the length of a star’s spikes. Trick & TIP Polygon settings apply only to the next polygon you draw; you cannot apply them to a polygon you’ve already created. 208 Page Layout with InDesign

SPECIFY CORNER OPTION OF RECTANGLE OBJECT Steps to Follow: using Step-1 : Draw Rectangle Rectangle Tool Step-2 : Click 'Object' menu. Step-3 : Click 'Corner options'. Step-4 : Select 'Effect', set the size. Step-5 : Click the 'Ok' button. GROUP OR UN-GROUP OBJECT You can combine several objects into a group so that they are treated as a single unit. You can then move or transform the objects with- out affecting their individual positions or at- tributes. Steps to Follow: Step-1 : Select All the object by selection Tool with holding Shift Key. Step-2 : Press Ctrl+G or select 'Group' option from 'Object' and Press Shift+Ctrl+G or 'UnGroup' op- tion from 'Object' menu. menu. Lab Activities 1. Draw the flowing objects using appropriate drawing Tools and set the ap- propriate parameters. Then type the text on the path as given. Smart Computer Science Book-7 209

Review Knowledge 1. Answer the following questions: a. How many sides are there in the polygon tool by default? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... b. How do you set the corner of a rectangle object? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... c. What are the two options of polygon setting? Ans: .................................................................................................................. .......................................................................................................................... .......................................................................................................................... d. In how many shapes can you change a rectangle? Ans: ................................................................................................................. .......................................................................................................................... e. What is the function of 'Type on Path Tool? Where do you find 'Type on Path Toll'? Ans: ................................................................................................................. .......................................................................................................................... .......................................................................................................................... 210 Page Layout with InDesign

Points to Know • Page layout is the process of planning, placing and arranging and rearranging text, graphics, pictures, and other elements of a document to be printed. • The primary software programs for desktop publishing are called page layout ap- plications or page layout software. • Adobe InDesign is a desktop publishing software application produced by Adobe Systems. • It can be used to create works such as posters, flyers, brochures, magazines, news- papers and books. • Tools are the components which are used to edit the object and text in the document. • Formatting refers to change the appearance of the document, paragraph and object of document. • The Place command is the primary method used to import graphics into InDesign. • Text Warp is a feature which allows to wrap the text around any object, including text frames, imported images, and objects you draw in InDesign. • Bullet List is known as the unordered list which begins with bullet characters. Num- ber List is known as ordered list which begins with an expression Terms to Know Wrap : Text around imported images. Stroke : Outline of the object. Desktop publishing : Use of the computer and software to create visual displays of ideas and information for printing. Gradient : A range of position-dependent colors, usually used to fill a region. Resolution : Sharpness and clarity of an image or picture Bullet : Series of items preceded with symbols instead of numbers. Smart Computer Science Book-7 211

Worksheet Objective Questions 1. Fill in the blanks: a. .................... .................. refers to the actual document page and its........................... b. Adobe InDesign is a ......................... ................................software applica- tion. c. ........................... are the components used to edit the object and text. d. Text in InDesign resides inside containers called ......................... .................... e. ............................ refers to change the appearance of the document. f. The ............................ command is the primary method used to import graph- ics into InDesign. g. ............................... objects are treated as a single unit. 2. State the wether the following statements are True or False. a. Adobe PageMaker is a Page Layout software. b. Books, news letters, brochures are designed in page layout software. c. Saving refers to keep your document in the hard disk temporary for only current use. d. Character formatting refers to change the appearance of whole document. e. Paragraph formatting makes effect to only selected text. f. Swatch panel helps to draw outline of an object. g. Wrap allows to wrap text around the object. 212 Page Layout with InDesign

Descriptive Questions 1. Answer the following questions: a. What do you mean by Page Layout? b. What do you mean by page layout software? c. Why do you use Adobe InDesign? d. Write any five features of Adobe InDesign? e. Differentiate between paragraph formatting and character formatting? Analytical Questions: 1. Let's observe the given image. Rad- hika Chaudhary has created this document. a. How many objects are treated by selection Tool? b. Radhika wants to change the posi- tion of the upper object. How is it possible ? c. After editing the position of object, does selection Tool treat as initial ? 2. Lets observe the given image. Pran- jal khadka has drawn these images in InDesign. a. Is there Tool to draw triangle di- rectly ? If no direct Tool, How could pranjal draw this triangle ? b. Is second object polygonal ? Which feature is used to draw second ob- ject. c. Is it possible to change this triangle to rectangle ? d. Pranjal is not satisfied with the second object. He is interested to change it into rectangle and put rounded corner, how will he do it ? Smart Computer Science Book-7 213

3. Let's observe the given image. Ra- mananda Yadab has typed this text on InDesign. a. Which Tool and technique are used by Ramnanda to type this text ? b. If something is wrong, How could you edit text in such a case ? c. Is it possible to change the position of text like first and last character are in same straight horizontal axis ? d. Ramananda is not satisfied with this, he is interested to change it into a triangle shape. How would you suggest him to solve this problem ? 4. Let's observe the given document. This document is prepared by me Prabhu Ram Khadka. a. Which alignment is used in this para- graph? b. Which techniques are used for format- ting the P character ? c. If I am interested to change the black to White Color of P character, How should I proceed ? d. If you are willing to add more spaces among the line, How would you add ? 5. Shivani has prepared a project work of Computer Science in InDesign: a. She is not getting hyphen in her document. How would you suggest her to activate this feature ? b. She is interested to add some spaces in each paragraph of document. How should she maintain this formatting ? c. Some of the important points are to be highlighted, but she doesn't have any idea about this. How would you suggest her to solve this problem ? 214 Page Layout with InDesign

Lab Project 1. Prepare the given page in the InDesign. COMPUTER HARDWARE Computer is formed by two types of components, which are hardware and software. Computer hardware can be compared with organs of human body. The physical components of com- puters are called hardware which we can see, touch, feel and take from one place to another place by physically. Computer hardware normally also called computer devices. It is classified into different categories such as : • Input Hardware • Processing Hardware • Output Device • Storage/Memory Hardware • Motherboard (Backbone hardware) 2. Draw the following: 3. Draw path with Pencil Tool then Type the following text on the pathss Practice make men perfectgiven Smart Computer Science Book-7 215

12Concept of Program Design CHAPTER Minu : Getting confused ! Can computer do every types of work ? This chapter includes: Anu : Well ! Computers work only • Introduction of Program and program Design. in the basis of instructions • Introduction of Algorithm mentioned in the computer and Flowchart. • Writing Algorithm. program. • Drawing flowchart. Minu : Wow ! Interesting ! It means we make program for working on computer. Anu : Yes ! you are right. Minu : May you tell me about to make computer programs ? Anu : First, we have to design the working principle with the help of program design tool. Minu : What are these Tool ! Anu : Algorithm and Flowchart are common program design tools. COMPUTER PROGRAM In the beginning of the book, we have read that computers are machines. They can't do anything on their own until they are given some directions. Computers under- stand the direction only, if they are given in a particular step-wise manner. These stepwise directions given t o the computer in the language which they understand is known as a Program. PROGRAM DESIGNING Before writing the computer program, it is necessary to design the program; where 216 Concept of Program Design

to be defined how computer perform a specified task. The program designing task is done using the tool which is called program designing tool. There are two types of common program design tools ; Algorithm and Flowchart. ALGORITHM Algorithm is a common program designing tool which includes step by step set of finite instructions that describes clearly how to perform a specific task. There are clearly defined start, steps wise process and ending of a task. It is written in our own language, it is a just paper work. Once the algorithm is written, it becomes easy to write the program in any high level language of computer. FLOWCHART Flowchart is another program designing tool, which is a graphical representation of an algorithm. Flowcharts play a vital role in the programming. It describes clearly about process and logic to complete a task in pictorial form. Flow chart is drawn using certain geometrical shapes, and used shapes are connected by arrow which show the flow of logic and processing task involved. Shape used in the Flowchart Geometrical Symbol Name of the Symbol Purpose Start/Stop Symbol. Shows start and end of task. Input/output Symbol. Shows the input output opera- tion of program. Processing Symbol. Shows the process or action in the program. L o g i c a l / D e c i s i o n Shows the decision making or making Symbol. choice in the flowchart. Flow Lines. Show the flow of the operation. Connector symbol It is used, if flowchart is not fit on single page to show the connection of different pages. Smart Computer Science Book-7 217

Illustrations 1. You have to write a program to ask any two numbers and find their sum for your computer. Now, design program by writing Algorithm and draw a Flowchart for this problem which becomes easy to write program in high level language. Algorithm START Step-1 : START Read A , B Step-2 : Read any two numbers S=A+B Step-3 : Add these values PRINT S Step-4 : Display result. Step-5 : STOP STOP 2. Your commuter has to ask any two different numbers and find the greater number but computer does not work itself. It needs program. Now, to solve this problem, design a program using algorithm and flowchart which helps you to write a pro- gram easily in high level language. Algorithm Flowchart Step-1 : Start START Step-2 : Ask two different numbers. Read A , B Step-3 : Compare both number to find greater. If first number is greater, print it. PRINT B No IS A>B ? Yes If second number is greater, print it. PRINT A Step-4 : Stop STOP Test Your Skill 1. You have to write a program to ask any two numbers and find their product for your computer. Now, design you program by writing Algorithm and draw a Flowchart for this problem which becomes easy to write program in high level language. 218 Concept of Program Design

Algorithm Flowchart ............................................................ ............................................................ ........................................................... ............................................................ ............................................................ ........................................................... ........................................................... ........................................................... ........................................................... 2. Your comuter has to ask any two different numbers and find the smaller number but computer does not work itself. It needs program. Now, to solve this problem, design a program using algorithm and flowchart which helps you to write a pro- gram easily in high level language. Algorithm Flowchart ............................................................ ............................................................ ........................................................... ............................................................ ............................................................ ........................................................... ........................................................... ........................................................... Smart Computer Science Book-7 219

Illustrations 1. Write an algorithm and flowchart to ask three numbers and find out greatest num- ber. Algorithm Flowchart Step-1 : Start START Step-2 : Ask three different numbers. Read A , B, C Step-3 : Compare three numbers with each other. Yes No - If first number is greatest, print it. IS A>B ? - If second number is greatest, print it. IS A>C ? No No - if third number is greatest, print it Yes IS B>C ? Step-4 : Stop Yes PRINT A PRINT C PRINT B STOP 2. Write an algorithm and flowchart to ask your name and print 10 times. Algorithm Flowchart Step-1 : START START Step-2 : Start to Count (Count=1) Count=1 Step-3 : Read your name Read Name Step-4 : Display your name Print Name Step-5 : Count one more (Count=Count+1) Count=Count+1 Step-6 : Is Count <=10 ? - if yes, repeat step Yes Step-7 : STOP Is Count <=10 ? No STOP 220 Concept of Program Design

Test Your Skill 1. Write an algorithm and flow chart to ask your marks of computer and find out you are passed or failed in the computer. If marks is above 40, you are passed other- wise you are passed. Algorithm Flowchart ............................................................ ............................................................ ........................................................... ............................................................ ............................................................ ........................................................... ........................................................... ........................................................... 2. Write an algorithm and draw flowchart to read 10 numbers and find their sum. Algorithm Flowchart ............................................................ ............................................................ ........................................................... ............................................................ ............................................................ ........................................................... ........................................................... ........................................................... Smart Computer Science Book-7 221

3. Write an algorithm and flowchart to read any two numbers and find their sum,product and difference. Algorithm Flowchart ............................................................ ............................................................ ........................................................... ............................................................ ............................................................ ........................................................... ........................................................... ........................................................... Points to Know • Stepwise directions given to the computer in the language which they under stand is known as a Program. • Program design refers to be defined how should computer perform a specified task. • Algorithm is a common program designing tool which includes step by step set of instructions that describes clearly how to perform a specific task. • Flowchart is a pictorial representation of an algorithm which describes clearly about process and logic to complete a task. Terms to Know Program : A collection of instructions that performs a specific task when executed by a computer. Logical : A method of reasoning that involves a series of statements. Algorithm : A step by step method of solving a problem. Flowchart : A type of diagram that represents a workflow or process. 222 Concept of Program Design

Worksheet Objective Questions 1. Fill in the blanks: a. Computer can not do anything itself until they are given some .............................. b ............................ and ........................... are common program designing tools. c. .............................. is a step by step finite instructions to perform a specific task. d. ........................... is a pictorial representation of an algorithm to solve a spe- cific task. 2. State the wether the following statements are True(T) or False (F). a. Flowchart describes clearly about process and logic to complete a task in pictorial form. b. Algorithm has infinite number of steps. c. Algorithm is a popular computer program. d. Computer can understand those instructions which are given only in step by step manner. 3. Match the Following: Group-B Group-A a. Processing box b. Connector c. Start/Stop box d. Input/Output e. Choice or decision making box f. Flow Line Smart Computer Science Book-7 223

Descriptive Questions 1. Answer the following questions: a. What do you mean by computer program? b. What do you mean by program designing tool? c. What does program design task include? d. What is flowchart? Analytical Case Study Questions : 1. Rampati chaudhary is assigned a task by her teacher to design a program using program design tool algorithm and a flowchart for the following case. a. Computer should ask quantity and rate of pen, copy and pencil and find out total amount. If total amount is above 5000, the discount is offered 10% of total amount. Now, this program should find out discount and net total amount. The net total is cal- culated by Total amount - discount. b. The output should display a sample cash memo. How would Rampati design to solve this problem ? Demonstrate your idea. 2. Designe a program using program design tool algorithm and flowchart for solving the given case using computer. a. Your computer ask marks obtained in all the subjects that you study in your class VII. calculate, total marks and percentage and your grade, The grade is calculated in the following logic. Percentage Grade >=90 A+ >=80 A >=60 B+ >=50 B >=40 C+ <40 C 224 Concept of Program Design

More on Qbasic CHAPTER Minu : How can it be instructed to 13 computer for repeating the same task for many times ? This chapter includes: Anu : How interesting questions • Loop Statements [FOR- ! You can use LOOP state- NEXT, WHILE-WEND, ments for this task. DO-LOOP] Minu : How does Looping stop • Library Functions. when repeating task is over ? Anu : We should use counter check technique to stop looping. Minu : Is there any easy provision for small frequent task ? Anu : Yes, for such tasks, Library functions are used. Minu : What are these ? Anu : They are ready made easy instructions coming with QBASIC system. LOOPING IN PROGRAM Loping refers to repeat a task for specified number of times in the program. The statement which is used to repeat a task during the program execution is called loop statement. Loop statements allow to execute one or more than one statement block for a number of times as long as condition is matched. Some time you face a situation to repeat a task many number of times. It is very tedious to write same code repeatedly many numbers time, in such situ- ation, you can use loop statement for the best performance. Q-basic supports Smart Computer Science Book-7 225

versatile loop statements. (a) FOR-NEXT (b) WHILE-WEND (c) DO WHILE- LOOP (d) DO UNTIL -LOOP FOR-NEXT Statement Function : Its function is to repeat a given instructions specified number of times. It has a defined a range of values which is controlled by control variable and represents number of repetition of loop. In every iteration or loop, control vari- able receives a new value and loop will be over when it takes whole range. Syntax : FOR <control variable> = <initial value> TO <final value> [STEP +/-] <Statement block> Assign control variable …………………….. …………………….. NEXT [Same counter variable] Increase/Decrease Is condition True ? Where, Control variable • Step function is to increase or de- crease the initial value. • If initial value is smaller than final Statement Block value that is known as STEP + case. In this case, loop repeats as long as initial value is smaller than or equal Exit from NEXT to final value. If you have to increase initial value by STEP +1, it is not compulsory to mention but in other cases we must mention. • If initial value is greater than the final value that is known as STEP- Case. In this case, loop repeats the specified statement block as long as initial value is greater than or equal to final value. Examples: b. CLS c. CLS FOR I=1 to 10 STEP 2 a. CLS PRINT I; NEXT I FOR I=1 TO 5 FOR I=10 to 1 STEP-1 END PRINT \"Sirjana\" PRINT I NEXT I NEXT I END END 226 More on Qbasic

1. Write the output : NEXT I END a. CLS Output :………………………………….......... FOR I=1 TO 5 g. CLS FOR I=50 TO 41 STEP -2 PRINT \"Ram\" PRINT I; NEXT I NEXT I END END Output :………………………………….......... h. CLS b. CLS FOR I=1 TO 5 PRINT I^2; FOR I=5 TO 1 STEP-1 NEXT I END PRINT I Output :………………………………….......... NEXT I i. CLS FOR I=1 TO 5 END S=S+I c. CLS NEXT I FOR I=1 TO 5 PRINT S PRINT I; END NEXT I END Output :………………………………….......... Output :………………………………….......... j. CLS d. CLS FOR I=10 TO 20 STEP 2 FOR I=1 TO 5 PRINT I; NEXT I PRINT 5*I; END Output :………………………………….......... NEXT I e. CLS FOR I=1 TO 5 STEP 1.5 END PRINT I, NEXT I Output :………………………………….......... END k. CLS Output :………………………………….......... FOR I=5 TO 1 STEP-2 f. CLS FOR I=0 TO 1 P=P*I PRINT I, NEXT I Smart Computer Science Book-7 227

PRINT P 3. Write a program to ask 10 numbers END and find their sum. Output :………………………………….......... CLS l. CLS FOR I=1 TO 10 P=1 INPUT \"Enter number:\";N FOR I=5 TO 1 STEP-1 S=S+N P=P*I NEXT I NEXT I PRINT S PRINT P END END 4. Write a program to ask 'n' numbers Output :………………………………….......... and find their sum. Sample Programs CLS INPUT \"Enter number of Time:\";N 1. Write a program to ask your name and FOR I=1 TO N print 10 times. INPUT \"Enter number:\";N1 S=S+N1 CLS NEXT I INPUT \"Enter Your name:\";N$ PRINT S FOR I=1 TO 10 PRINT N$ 5. Write a program to ask a number and NEXT I display multiplication table. END CLS 2. Write a program to ask your name and INPUT \"Enter number:\";N print 'n' times. FOR I=1 TO 10 PRINT N;\"*\";I;\"=\";N*I CLS NEXT I INPUT \"Enter number of Time:\";N END INPUT \"Enter Your name:\";N$ FOR I=1 TO N PRINT N$ NEXT I END 228 More on Qbasic

Test Your Skill ……………………………………………… 4. Write a program to ask a number and 1. Write a program to ask 5 numbers and find their product. display multiples up to 10th terms. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ ................................................................ 5. Write a program to display 100, 98, ................................................................ 96, 94…………92. ................................................................ 2. Write a program to find the sum of 50 ……………………………………………… ……………………………………………… to 41. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ 6. Write a program to display 4, 8, ……………………………………………… 12……40. ………………………................................ 3. Write a program to display cube value ……………………………………………… ……………………………………………… of 1 to 10 ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ Smart Computer Science Book-7 229

7. Write a program to find the sum of ……………………………………………… only even numbers from 2 to 100. ………………………................................ ……………………………………………… ................................................................ ……………………………………………… 9. Write a program to find the sum of : ……………………………………………… 1, 2, 3, ......................up to 'n' . ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ ……………………………………………… ................................................................ ……………………………………………… 8. Write a program to find the sum of ……………………………………………… ………………………................................ only odd numbers from 1 to 100. ................................................................ ................................................................ ……………………………………………… ................................................................ ……………………………………………… ……………………………………………… ……………………………………………… WHILE-WEND statement Initial Value Function : Its function is to repeat a se- Is condition ries of statements or a state- True ? ment mentioned in a loop Increase/Decrease block as long as condition is Statement Block true. When condition returns false then loop stops and ex- ecute after WEND statement. Exit Point 230 More on Qbasic

Syntax : WHILE <condition> • Condition is an expression that will return true or <Statement bllock> false; which may be numeric or string expression. …………………….. • Statement block is any number of statements on one ………………………. or more lines which are to be executed as long as condition is true. WEND Example - 1 • Write a program to print 'Ram' 10 times. CLS • Here, initial value of loop is defined I=1 which is smaller than 10 which returns the true value. So, I=1 statement mentioned between WHILE-WEND will WHILE I <= 10 be executed as long as condition is true. The con- dition is true until the value of I is smaller or equal PRINT \"Ram\" to 10. The value of I is increased by 1. So, loop will I=I+1 be repeated 10 numbers of times. You can type the WEND END above programs and see the output. Example - 2 • Write a program to find the sum of 10 to 1. CLS I = 10 • Here, initial value of I is defined 10 and final value WHILE I >= 1 is defined 1. First time value of I =10 is greater than PRINT I 1. So, condition is true, it executes statements men- S=S+I tioned within a loop. Value of I is decreased by 1. I=I-1 So, condition will return true ten times. WEND PRINT \"Sum=\"; S END Example - 3 • Write a program to ask more numbers as you like and print their sum. CLS • Here, string expression is used as a condition. The CH$ = \"Y\" condition is true until the content of CH$ is capital WHILE CH$ = \"Y\" \"Y\". So, As soon as you type capital \"Y'\" in your INPUT \"Enter number:\"; N choice, it repeats your loop block and ask number , S=S+N add it and display choice INPUT \"Do you want to continue [Y/N]:\"; CH$ Smart Computer Science Book-7 231

WEND PRINT \"Sum=\"; S END Characteristics of WHILE-WEND a. Variable used in the test condition must be initialized in any place before start- ed the WHILE. b. The body of the loop must changes the value of the variable used in the tested condition. Otherwise, condition will remain true in every repetition and loop will never terminate, called infinite loop. c. String expression also can be used in the test condition. TEST YOUR SKILL 3. Write a program to display 1, 3, 5.... 1. Write a program to display 1, 2, 3, ..10 up to 99. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ ………………………................................ ................................................................ ................................................................ 2. Write a program to display 10, 9, 8, ..1 4. Write a program to display 100, 98, ……………………………………………… 96....up to 2. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………................................ ……………………………………………… ................................................................ ……………………………………………… ………………………................................ ................................................................ 232 More on Qbasic

5. Write a program to display 1, 4, 9....up ……………………………………………… to 10th terms. ……………………………………………… ……………………………………………… ………………………................................ ……………………………………………… ................................................................ ……………………………………………… DO-LOOP STATEMENT DO-LOOP statement is more powerful and versatile loop than WHILE-END loop statement. It repeats statement block mentioned within a loop while a condition is true or until a condition is true. The DO-LOOP statement has two structures: a. Pre-Test b. Post Test Initial Value Pre-Test: This structure controls the loop in the entry point. It checks the condition in the entry point and if it returns the true Increase/Decrease Is condition result, it enters within a loop, otherwise it satisfied? does not enter within a loop. Syntax : DO [WHILE|UNTIL]< condition> Statement Block [statement block Exit Point ………………… …………………] LOOP Example - 1 REM: Example of Pre-Test with WHILE condition CLS I=1 DO WHILE I <= 10 PRINT I, I ^ 2 I=I+1 LOOP END Smart Computer Science Book-7 233

Example - 2 REM: Example of Pre-Test with UNTIL condition Initialize Control CLS variable I=1 Statement Block DO UNTIL I > 10 Is condition No PRINT 5 * I satisfied? I=I+1 LOOP Yes END Exit Point Post Test: This structure controls the loop in the exit point. It enters within a loop block and executes mentioned statement block Increase/Decrease and it checks the condition in the exit point. If it returns the true result, it repeats a loop, otherwise it does not repeat a loop, and it exits from this point. Syntax : DO Statement block ………………... ……………….. LOOP [WHILE | UNTIL] condition] Example : 1 REM: Example Of Post Test with WHILE condition CLS I=1 DO PRINT I, I ^ 3 I=I+1 LOOP WHILE I <= 10 END 234 More on Qbasic

Example : 2 REM: Example of Post Test with UNTIL condition CLS I=1 DO PRINT 5 * I I=I+1 LOOP UNTIL I > 10 END Difference between Pre-test and Post test CLS I = 10 DO WHILE I <= 1 ‘Entry point of loop PRINT \"RAM\" I=I+1 LOOP ‘Exit point of the loop END • Here, it is applied the pre-test of DO WHILE-LOOP. It performs the test operation in the entry point of the loop. Here, value of I is 10 in the beginning, which is not smaller than or equal to 1. So, it returns false and does not enter within a loop block. Here you will get the output as blank screen. CLS I = 10 DO PRINT \"RAM\" I=I+1 LOOP WHILE I <= 1 END • Here, it is applied the post-test of DO-LOOP with WHILE. It performs the test operation in the exit point of the loop. Here, value of I is 10 in the beginning, it does not matter. Execution enters within the loop block and performs task then it tests the condition which is not small- er than or equal to 1. So, it returns false and does not repeat a loop and exits from the loop. Here you will get the output RAM one time on the screen. Same principal applies with DO-LOOP with UNTIL So, it proves that in pre-test, it may not enter even one time within a loop but in post test it enters within a loop at least one time. Smart Computer Science Book-7 235

TEST YOUR SKILL ……………………………………………… ……………………………………………… 1. Write a program to ask your name and ……………………………………………… print 10 times using Pretest WHILE ………………………............................... condition. ................................................................ 4. Write a program to display 50, 45, 40, ……………………………………………… 35, ......................up to 5. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ………………………............................... ……………………………………………… ................................................................ ……………………………………………… 2. Write a program to display square val- ……………………………………………… ………………………............................... ue of first 10 natural numbers. Using ................................................................ Post Test WHILE condition. 5. Write a program to ask a number and ……………………………………………… display multiplication table up to 10th ……………………………………………… ……………………………………………… terms. Using Post Test UNTIL condi- ……………………………………………… tion. ……………………………………………… ……………………………………………… ………………………............................... ……………………………………………… ................................................................ ……………………………………………… 3. Write a program to find the sum of 10 ……………………………………………… ……………………………………………… input numbers. Using Pre Test UNTIL ………………………................................ condition. ................................................................ 6. Write a program to ask your school ……………………………………………… ……………………………………………… 236 More on Qbasic

name and print 'n' times using Pre ……………………………………………… Test UNTIL condition. ……………………………………………… ……………………………………………… ………………………................................ ……………………………………………… ................................................................ ……………………………………………… ................................................................ 8. Write a program to display cube value ……………………………………………… of 10 to 1. Use Pre Test UNTIL condi- ……………………………………………… tion. ………………………................................ ……………………………………………… ……………………………………………… ................................................................ ……………………………………………… 7. Write a program to display 10, 9, ……………………………………………… 8,................1. Use Post Test UNTIL condition. ……………………………………………… ……………………………………………… ……………………………………………… ………………………............................... ……………………………………………… ................................................................ LIBRARY FUNCTION The functions which are attached and ready to use in the QBASIC system is called library functions. The library functions are also called built-in func- tions, in-built functions, standard function or system defined functions be- cause these functions come by built with the QBASIC system. The library functions should be called by programmer by passing argument within the small bracket to use in the program. We discuss some of the common Library functions here. LEFT$ () Function : Its function is to return the specified number of characters from the left most side of the string. Syntax : LEFT$(string expression, n) Smart Computer Science Book-7 237

• Where string expression may a string variable or string constant. n is an integer value or variable in the range 0 to 32767 that represents numbers of characters extracted from left most side of the string . Example : CLS PRINT LEFT$(“KATHMANDU”,3) END • Here, it extracts 3 characters KAT from the left hand side of passed string argument “KATHMNADU”. TEST YOUR SKILL Output Output 1. Write the output of following Programs: a. CLS W$ = \"PATAN\" FOR I = 1 TO 5 PRINT LEFT$(W$, I) NEXT I END CLS b. W$ = \"PATAN\" N=5 FOR I = 1 TO 5 PRINT LEFT$(W$, N) N=N-1 NEXT I END RIGHT$ () Function : RIGHT$ is a string function which is used to extract the specified num- ber of characters beginning from the right most characters of the string. Syntax : RIGHT$(string expression, n) • Where string expression may a string variable or string constant. n is an integer value or variable that represents numbers of characters extracted from right most side of the character. Example : CLS PRINT RIGHT$(“KATHMANDU”,4) END • Here, it extracts 4 characters ANDU from the right hand side of passed string argu- ment “KATHMNADU” 238 More on Qbasic

TEST YOUR SKILL Output 1. Write the output of following Programs: a. CLS W$ = \"PATAN\" FOR I = 1 TO 5 PRINT RIGHT$(W$, I) NEXT I END CLS b. W$ = \"PATAN\" Output N=5 FOR I = 1 TO 5 PRINT RIGHT$(W$, N) N=N-1 NEXT I END MID$ () Function : MID$() is used to extract specified number of characters from middle of a string. It is more powerful than LEFT$ () and RIGHT$ () because it can perform the task which is performed by LEFT$() and RIGHT$(). Syntax : MID$(string expression, start, n) • Where string expression may a string variable or string constant. Start represents the position measured from the left-most character of passed string. N represents number of characters to extract. Example : CLS PRINT MID$(“KATHMANDU”,1,3) ‘ it extracts KAT PRINT MID$(“KATHMANDU”,4,3) ‘ it extracts HMA PRINT MID$(“KATHMANDU”,7,3) ‘ it extracts NDU END TEST YOUR SKILL 1. Write the output of following Programs: a. CLS W$ = \"PATAN\" SP = 3 N=1 Smart Computer Science Book-7 239

FOR I = 1 TO 3 Output PRINT MID$(W$, SP, N) Output SP = SP - 1 N=N+2 NEXT END b. CLS W$ = \"PATAN\" SP = 1 N=5 FOR I = 1 TO 3 PRINT MID$(W$, SP, N) SP = SP + 1 N=N-2 NEXT END TEST YOUR SKILL 3. Write a program to ask your first name and print two characters from second 1. Write a program to ask your name position. and print first two characters. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… 2. Write a program to ask your name 4. Write a program to display following: and print three characters from the right hand side. a. P PR ……………………………………………… PRO PROG ……………………………………………… PROGR PROGRA ……………………………………………… PROGRAM ……………………………………………… ……………………………………………… ……………………………………………… 240 More on Qbasic

……………………………………………… ................................................................ ……………………………………………… ................................................................ ................................................................ ................................................................ ................................................................ ................................................................ ................................................................ d. PROGRAM PROGR ................................................................ PRO P b. PROGRAM PROGRA ……………………………………………… PROGR PROG ……………………………………………… PRO PR ……………………………………………… P ……………………………………………… ……………………………………………… ……………………………………………… ................................................................ ……………………………………………… ................................................................ ……………………………………………… ................................................................ ................................................................ ................................................................ e. G ................................................................ OGR ROGRA ................................................................ PROGRAM ................................................................ ……………………………………………… c. P ……………………………………………… PRO ……………………………………………… PROGR ……………………………………………… PROGRAM ................................................................ ……………………………………………… ……………………………………………… ................................................................ ……………………………………………… ................................................................ ……………………………………………… ................................................................ Smart Computer Science Book-7 241

f. PROGRAM ……………………………………………… ROGRA ……………………………………………… OGR ................................................................ G ……………………………………………… ................................................................ ……………………………………………… ................................................................ TAB () ................................................................ Function : The TAB is a device I/O function that moves the print position when used with the PRINT or LPRINT statements. Syntax : TAB(column) • Where, column is a numeric expression that has an integer value between 1 and column-width of the display device - 1). Example : CLS PRINT TAB(1); “A” PRINT TAB(40); “B” PRINT TAB(78; “C” END • Here, program prints A, B, C in column number 1, 40 and 79 respectively. There are 80 columns in a screen that is 0 to 79. LOCATE() Function : The LOCATE is a device I/O control statement that moves the cursor to the specified position of the screen. The position is formed by intersec- tion of row and column. Syntax : LOCATE row, column • Where, row and column represents values of line and column number respectively, which are intersected with each other and form a cell where cursor will be located. There are 24 rows and 80 columns in the default QBASIC Screen. Example : CLS LOCATE 5,10 PRINT “NEPAL” LOCATE 10,15 PRINT “IS” LOCATE 15,15 PRINT “GREAT” END 242 More on Qbasic

• Here, it prints ‘NEPAL’ in the line number 5 and column number 10. It prints ‘IS’ in line number 10 and column number 15 and “GREAT” will be printed in the line number 15 and column number is also 15. LEN () Function : It is a string processing function which returns the number of characters in a string or the number of bytes stored by a variable. Syntax : LEN (string) • String may be constant or variable. Example : CLS W$= “KATHMANDU” PRINT LEN(W$) END • Here, it displays 9, which is number of characters or bytes stored in the W$. SQR () Function : The SQR is a mathematical function that returns the square root of any positive number. Syntax : SQR(n) • Where, n is a positive number which may variable or constant. Example : CLS N=16 PRINT SQR(N) PRINT SQR(5) END TEST YOUR SKILL 2. Write a program to display 1 to 10 with their square root. 1. Write a program to ask a number and display it's square root. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ................................................................ Smart Computer Science Book-7 243

3. Write a program to ask your name ……………………………………………… and print it's length. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… b. * ……………………………………………… 4. Write a program to ask your name * * and print coordinate of row number 11 * and column number 25. * ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… 5. Write a program to ask your school ……………………………………………… name and print on column number 40. ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… c. P ……………………………………………… A 6. Write a program to display T A N a. * ……………………………………………… * ……………………………………………… * ……………………………………………… * ……………………………………………… * ……………………………………………… ……………………………………………… ……………………………………………… ……………………………………………… 244 More on Qbasic


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook