[go: up one dir, main page]

0% found this document useful (0 votes)
6 views4 pages

Afsaa Assignment

The document provides an overview of programming concepts, including definitions of programming, functions, and languages. It outlines key steps for developing a computer program, such as problem identification, coding, testing, and maintenance, along with an example algorithm and C++ program for calculating the sum and area of a triangle. Additionally, it explains problem definition and processes in programming, highlighting the importance of input, process, and output.

Uploaded by

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

Afsaa Assignment

The document provides an overview of programming concepts, including definitions of programming, functions, and languages. It outlines key steps for developing a computer program, such as problem identification, coding, testing, and maintenance, along with an example algorithm and C++ program for calculating the sum and area of a triangle. Additionally, it explains problem definition and processes in programming, highlighting the importance of input, process, and output.

Uploaded by

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

KILIMANJARO INSTITUTE OF TECHNOLOGY AND

MANAGEMENT

STUDENT NAME : MARY GEORGE MWINGIRA


REG NUMBER : KITM0125O/CIT/024
MODULE NAME : FUNDAMENTALS OF PROGRAMMING.
MODULE CODE : CIT 04208
COURSE : CIT
TUTOR : MR.MOHAMED
ASSIGNMENT

1(A). Define Programming

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++.

B. Describe Programming Functions

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.

C. Explain Programming Language

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.

 Examples of Programming Languages: Python, Java, C++, JavaScript, and HTML

2 (A). Identify Key Steps for Developing a Computer Program

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.

B. Describe Steps for Developing a Program

 Problem Understanding: Clarify what the program should do (e.g., a calculator).


 Planning: Design the solution using an algorithm or flowchart.
 Coding: Write the code in a chosen programming language.
 Debugging: Fix any code errors.
 Testing: Verify the program works as expected.
 Deployment: Release the program for use.

C. Create an Algorithm and Write a Program

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;
}

3(A) . Explain the Problem Definition on Table

Problem Definition is the clear explanation of the problem the program should solve. It includes
identifying inputs, processes, and expected outputs.

Component Description

Input The data provided to the program (e.g., two numbers).

Process The operations performed (e.g., addition).

Output The result of the process (e.g., sum of two numbers).

 Example: A program to calculate the average of three numbers.

B. Explain Processes in Programming

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:

Start → Input Base, Height → Calculate Area → Display Area → End

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;
}

You might also like