Afsaa Assignment
Afsaa Assignment
MANAGEMENT
Programming is the process of creating a set of instructions that a computer can follow to perform
specific tasks. These instructions are written in a programming language such as Python, Java, or C++.
Programming functions are self-contained blocks of code designed to perform a specific task. Functions
help in organizing code, making it reusable, and improving code readability.
A programming language is a formal language that provides a way for humans to communicate
instructions to a computer. These languages have syntax rules that define how instructions are written.
1. Problem Identification: Understand the problem that the program should solve.
2. Requirement Analysis: Gather all requirements needed for the solution.
3. Design: Create a plan for the program (algorithm, flowcharts).
4. Coding: Write the program using a programming language.
5. Testing: Run the program and check for errors.
6. Deployment: Make the program available for use.
7. Maintenance: Update and improve the program as needed.
Algorithm:
1. Start.
2. Input two numbers.
3. Calculate their sum.
4. Display the sum.
5. End.
Program (C++):
#include <iostream>
using namespace std;
int main() {
int num1, num2, sum;
cout << "Enter two numbers: ";
cin >> num1 >> num2;
sum = num1 + num2;
cout << "The sum is: " << sum;
return 0;
}
Problem Definition is the clear explanation of the problem the program should solve. It includes
identifying inputs, processes, and expected outputs.
Component Description
A process in programming refers to any series of operations performed by the program to achieve a
task.
Example Processes:
o Reading user input.
o Performing calculations (addition, subtraction).
o Displaying output.
o Saving data to a file.
C. Use Algorithm and Flowchart to Develop a Design of a Program
Algorithm:
1. Start.
2. Input the base and height of a triangle.
3. Calculate area using Area = (1/2) * base * height.
4. Display the area.
5. End.
Flowchart:
Program (C++):
#include <iostream>
using namespace std;
int main() {
float base, height, area;
cout << "Enter base and height: ";
cin >> base >> height;
area = 0.5 * base * height;
cout << "The area is: " << area;
return 0;
}