Basic programming principles by H. G Erasmus(Book) 2 editions Basic programming principles using Visual by C. M Pretorius(Book) 1 edition. CM Pretorius and HG Erasmus. Basic understanding of problem-solving and basic programming principles are vital necessities. .. an equation. For example, a = b + c, where a must be a numeric variable that if code = “H” then. BASIC PROGRAMMING PRINCIPLES. PRETORIUS C. ISBN: Estimated delivery within business day. R Add to Basket Added.
|Published (Last):||12 March 2015|
|PDF File Size:||11.67 Mb|
|ePub File Size:||3.79 Mb|
|Price:||Free* [*Free Regsitration Required]|
Erasmus, H. G. (Hetsie G.)
We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower.
Published by Jasper Riley Modified over 3 years ago. Use, develop and design structured programming methods 2. Use modularization from the chosen programming language 3. Produce appropriate documentation for a given program application. Create and apply appropriate test schedules. G, Basic Programming Principles. And programmers think in an unnatural way WOW!!!!
You learned to do it once when you were a child and now it just happens on its own!!!
Computers require these instructions to be precise and complete in every way As humans we have an incredible brain which lets us give vague commands and still get the correct answer. Thus, programmers have to learn to think in anunnatural way: Programmers make lots of money.
Programming really is fun. Programming is very intellectually rewarding. Programming makes you feel superior to other people. Programming gives you complete control over an innocent, vulnerable machine, which will do your evil bidding with a loyalty not even your pet dog can rival. Repeat the whole process until the program is finished.
An object or thing that you can describe. A data type is a classification of what kind of data the variables will hold The attributes are the variables An entity has attributes,characteristics.
Whole numbers positive or negative e. Numbers with fractions e. A single letter, number or special character or symbols e. Is there a lesson today?
Type Description Example Numeric variables used on numbers where calculations should take place. Do the following variable names comply with the rules? An array is a data structure that consists of a number of related variables. The array can hold numerous values but identical data types.
An array has a single name A single variable in an array is called an element All the elements in an array are the same data type The position of an element in an array is called an index. The name of this array is weekDays wekdays contains the names of the 7 days in a week We declare the variables of this array as: It is the position of an element in an array. The value of an index is always positive integer or a zero The index of the first element is always 0 and the index of the last element is number of elements – 1 see diagram slide 24 Referencing: Used also to retrieve an individual value from the array.
The name of the array and the index are used. For example weekDay 0 refers to Mon,weekDay 5 refers to. Each element is called month and an index is used to retrieve the individual values from the array. Like the example on slide 24 Two dimensional array consists of a number of rows and columns One dimensional array two dimensional array This array show the minimun Temperatures for the past seven Days of the week 3 4 5 2 6 18 22 23 24 19 25 This array shows the minimum and Maximum temperatures for the past Seven days.
Row 3 column 0 contains minimum and maximum temperatures for day 4 that is 3 and 24 If the name of the array is temperature,to reference a particular element we specify both the row and the column number: Declare array 1 2 3 4 5 Step 1: Retrieve value from bucket system. How do you make sure that you have understood the problem. Read the problem carefully 2.
Understand what the problem entails 3. Only then write down the steps to solve the problem Algorithm: Is a set of instruction written in a specific sequence used to solve a problem Three phases of an algorithm: What the required results will be. The name of an algorithm starts with an uppercase letter. The last statement or step is always end. The statements or instructions between the name of the algorithm and the end are called the body of the algorithm.
A comment can be on a separate line or can follow in the same line as an instruction. A comment can be included anywhere in an algorithm. Display means that a message or the contents of a variable are displayed shown on the computer screen. Enter indicates that data must be entered via the keyboard. Calculation can also be done using equations.
Not available in the problem statement. The user has to supply the numbers. Add the two numbers to determine the sum.
The sum as calculated in the processing phase and displayed on the computer screen. The student needs to know how many hours he has to work at what rate of pay before he can calculate the final amount he will receive. The input data must be processed to give the output information ,which is the amount the student will receive.
It is clear that the input data is meaningless unless it is processed, becauseif the student knows how much he will receive per hour, but does not knowhow many hours he will work, the pay cannot be calculated! In this case, the purpose of the algorithm is explained. In this case, the text inside the quotes is displayed. The enter name statement causes the computer to show a prompt on the screen so that the user can use the keyboard to type a name.
This name is stored in the variable called name. The next two statements enable the user to enter the age of a person to store in the variable called age.
The output is The name of the learner is John. We have now displayed a constant and the content of a variable. The same rules apply to the next statement, which displays The age of the learner is Calculate and display the distance in metres and then calculate and display the distance in centimetres Input Processing Output Prompt to read kilometer Kilometer meter Enter kilometremetre centimeter Calculate metrecentimetre Calculate centimetre Display metre Display centimetre.
Input Processing Output num1 Prompt for num1 and num2 average num2 Enter num1 and num2 Calculate average Show average on the screen.
Enter the number of hours he worked for a specific week, as well as the pay rate per hour. He has to pay R8 towards the recreation club. Input Processing Output hours Prompt for input fields wage rate Enter hours and rate rate Calculate wage Display wage on screen. What is the output? Draw a trace table? She pays R on rent for her room and the remainder of the money is divided as follows: Enter her monthly salary, which is never less than R1, on the keyboard and then calculate and display how much money she has available for the various categories.
However, customers can also buy items in bulk packages of 50 orin which case a discount per item applies. Draw the IPO Write the algorithm What is the output given price of one item is R50 Complete the trace table Instruction amtOne amt50 amt save1 save2 amt50 amt save50 save output. The total weight of the plate and the food must be entered. The plate weighs 1. The customer has to pay R7. Display the weight of the food in kg as well as the amount due.
Draw the IPO Write the algorithm. Test your algorithm by doing a trace table 1,Enter two integers. Calculate and show the sum, difference and product of these two integers on the screen.
Enter the number of rows of chairs in the city hall as well as the number of chairs per row. Enter values of the minimum and maximum temperatures for a givenday, then calculate the average temperature of the day. Calculate double, half, a third and a quarter of vasic number and show the result on the screen. The data type of the result must be real. Henry rents a trailer to move stock to a store.
The basic cost is R per day. He also pays a specific amount per kilometre travelled, entered by the owner. The owner also has to enter the kilometresand the number of days that Henry rented the trailer. Determine and show the amount due on the screen.
They are used to perform actions in a program. A program task is to: