0% found this document useful (0 votes)
33 views

2nd Semester Program

The document provides an overview of key concepts in systems development and programming including: 1. The systems development life cycle which includes planning, analysis, design, implementation, and maintenance phases. 2. Key aspects of program quality like efficiency, maintainability, portability, and readability. 3. Basic programming constructs like variables, operators, conditional statements, switch statements, and loops. Variables represent and store values, conditional statements like if/else evaluate conditions, and loops repeat blocks of code. 4. The first program example prints "Hello World" using Dart programming language basics like the main function and print statement.

Uploaded by

shang abdalqadr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

2nd Semester Program

The document provides an overview of key concepts in systems development and programming including: 1. The systems development life cycle which includes planning, analysis, design, implementation, and maintenance phases. 2. Key aspects of program quality like efficiency, maintainability, portability, and readability. 3. Basic programming constructs like variables, operators, conditional statements, switch statements, and loops. Variables represent and store values, conditional statements like if/else evaluate conditions, and loops repeat blocks of code. 4. The first program example prints "Hello World" using Dart programming language basics like the main function and print statement.

Uploaded by

shang abdalqadr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Index – KGS School Mobile App

Computer 2nd semester

Chapter 1

Systems Development Life Cycle


The Systems Development Life Cycle describes a process for planning, creating, testing, and
deploying an information system.

Computer professionals that oversee creating


applications often have the job title of System
Analyst. The major steps in creating an
application include the following and start at
Planning step.

During the Design phase, the System Analyst will


document the inputs, processing, and outputs of
each program within the application. During the
Implementation phase, programmers would be
assigned to write the specific programs using a
programming language decided by the System
Analyst. Once the system of programs is tested the new application is installed for people to
use. As time goes by, things change, and a specific part or program might need repair.
During the Maintenance phase, it goes through a mini planning, analysis, design, and
implementation. The programs that need modification are identified and programmers
change or repair those programs. After several years of use, the system usually becomes
obsolete. At this point, a major revision of the application is done. Thus, the cycle repeats
itself.

Applications:
An information system or collection of programs that handles a major task.

Implementation:
The phase of a Systems Development Life Cycle where the programmers would be assigned
to write specific programs.

Systems Development Life Cycle:


Planning – Analysis – Design – Implementation –Maintenance
Index – KGS School Web Design
1.1 Program Quality
Program quality describes fundamental properties of the program’s source code and
executable code, including reliability, robustness, usability, portability, maintainability,
efficiency, and readability.

Efficiency:
The measure of system resources a program consumes.

Maintainability:
The ease with which a program can be modified by its present or future developers.

Portability:
The range of computer hardware and operating system platforms on which the source
code of a program can be compiled/interpreted and run.

Readability:
The ease with which a human reader can comprehend the purpose, control flow, and
operation of source code.

Reliability:
How often the results of a program are correct.

Robustness:
How well a program anticipates problems due to errors.

Usability:
The ease with which a person can use the program.

1.2 Your First Program


Dart

Dart is a client-optimized language for developing fast apps on any platform. Its goal is to
offer the most productive programming language for multi-platform development, paired
with a flexible execution runtime platform for app frameworks.

Languages are defined by their technical envelope—the choices made during


development that shape the capabilities and strengths of a language. Dart is designed for
a technical envelope that is particularly suited to client development, prioritizing both
development (sub-second stateful hot reload) and high-quality production experiences
across a wide variety of compilation targets (web, mobile, and desktop).
2
Index – KGS School Web Design
1.2.1 Hello World Program
Every app has a main() function. To
display text on the console, you can use
the top-level print() function:

void main() { }

This line declares a function called main(). In short, they are a block of statements that the
computer executes when the function is “called.”

The void indicates that the main() function will not return any value.

print( ‘Hello, World!’ );

calls a function built into Dart named “print,” which will print out any line of text to the
console. A piece of text is known as a string

Chapter 2

2.1 Variables
In our Hello World Fancy program, we did not formally declare1 any of our own variables.
However, variables are a basic building block of programming languages. Do you remember
algebra? Where “x” was a variable that represented a number? Variables in programming
are not too different. A variable is used to represent a value and to hold onto it for future use.
= is used differently in Dart than it is in algebra. As has been mentioned before, = is used in
Dart for assignment (assigning values to variables). In Dart, == is used for equality.

var x = 5;

In Dart, this code assigns the value of 5 to the variable x. Similarly,

the next example assigns the string literal "antelope" to the variables animalWord.

var animalWord = "antelope";

3
Index – KGS School Web Design
In the next example, the variable coolWord is assigned the value of the string literal
"antelope" Variables may also have a type. For now, you can think of a type as a way of
insisting that a variable only hold a specific kind of value,although this is not completely
accurate. coolWord is specified to be of type String.

String coolWord = "antelope";

Now we can reassign to coolWord another value of type String.

coolWord = "dog";

But, we cannot assign a non-String to coolWord.

coolWord = 5; //WRONG - This will raise a warning.

Types are optional in Dart. However, they are useful when we want to ensure the safety of
some of our variables by enforcing a specific type. Types are also helpful when debugging.

2.2 Operators
Operators are used for doing operations. “What’s an operator?” you say. Well, you already
know one! = is the assignment operator. We’ve been using the = operator to assign the
value on the right of an expression to the variable on the left. Dart comes with arithmetic
operators that work as you would expect.

4
Index – KGS School Web Design
Chapter 3

3.1 Conditional Structure


Often in programming, it is necessary to enable the machine to make a decision.

if (temperature > 75) {


print("It is hot today."); //print is used to output text to the console
}

The statements within the curly braces of an if-statement will only be executed if the
statement inside of its parentheses is true. In this case, “It is hot today.” will only be printed to
the console if the variable temperature holds a value greater than 75. > is an operator for
comparison that means “greater than.” If it’s not hot today, maybe we want to print
something else out.

if (temperature > 75) {


print("It is hot today.");
} else {
print("It is not that hot today.");
}

That statement within the curly braces after the else will always be executed when the
value held by temperature is not greater than 75. It will not be executed when the
temperature is above 75.

if (temperature > 75) {


print("It is hot today.");
} else if (temperature > 50) {
print("It is mild today.");
} else {
print("It is cold today.");
}

Now there are three distinct possibilities. else if enables us to expand the number of
branches in our decision tree. If the temperature is greater than 75, then we will say it is hot.
If the temperature is less than or equal to 75 but greater than 50, then we will say it is mild. If
the temperature is less than or equal to 50, then we will say that it is cold. If you do not
follow, go over it again and think about it in the English terms from this paragraph.

5
Index – KGS School Web Design

Chapter 4

4.1 Switch Statement


A switch-statement makes it convenient to decide between many different possibilities.

switch (favoriteAnimal) {
case "dog": // if favoriteAnimal is equal to "dog" do the following
print("Bark!");
break; //we need one of these at the end of every case but default
case "cow":
print("Moo!");
break;
case "cat":
print("Meow!");
break;
default:
print("Your animal is a new species to me!");
}

The variable we are comparing is the one in parentheses immediately following the switch-
statement. In this case, it is favoriteAnimal. break statements appear at the end of every
case. Not including one may raise an exception. The default option is a catch all if none of
the other cases matched the value of the variable in question. It does not require a break
statement at its end. It is good practice to always include a default clause. This is mostly for
safety reasons—to deal with unexpected values. switch-statements can work with other

6
Index – KGS School Web Design
types as well. They can also have empty cases that “fall-through” to the next case when
there is a match.

Chapter 5

4.1 Loops – While Loop


Often in programming, we will have to repeat some lines of code. Rather than type them
again and again, we have something known as a loop. Technically, loops are control
structures too, but for readability, they are presented in a separate section here. Notice
that, like if-statements, loops evaluate Boolean expressions.

int num = 99;


while (num > 0) {
print("$num");
num --;
}

The while-loop will keep executing the lines between the parentheses until num is no longer
greater than 0. Do you remember the -- operator? Again, it is an operator that subtracts 1
from a number. It is used equivalently to this line of code:

num = num - 1;

4.2 Loops – do While Loop


num = 99;
do {
print("$num");
num--;
} while (num > 0);

This is the same as the last loop, except that in a do-while-loop, the check is at the end of
the loop instead of at the beginning. This doesn’t make a difference for our program, but it
can be useful in situations where you always want the first iteration of the loop to execute,
regardless of whether the comparison evaluates to true or false.

7
Index – KGS School Web Design
4.3 Loops – For Loop
int total = 0;
for (int count = 1; count <= 10; count++) {
total = total + count;
}
print("The sum of the numbers 1 through 10 is: $total");

Again, this loop is the same as our last two. It looks very different, though, doesn’t it? for-
loops are compact and extremely useful. Within the parentheses, you have three
statements. The first is an opportunity to create a variable and set its value (this variable is
only accessible within the for loop if it is declared here). The second is a comparison that
must hold for us to continue the loop. The last is what we want to do at the end of each
iteration of the loop.

You might also like