Professional Documents
Culture Documents
5th Programming Assignment
5th Programming Assignment
Learning outcome 1: Define basic algorithms to carry out an operation and outline the process of
programming an application....................................................................................................................2
P1: Algorithm, Explanation, Problem..................................................................................................2
M1: Application Programming process...............................................................................................2
D1: Implementation of algorithm........................................................................................................2
Learning outcome 2: Characteristics of procedural, object-orientated and event-driven
programming.............................................................................................................................................3
P2: Explanation, Features, and Relationships:...................................................................................3
M2: Compare, Contrast used with a source code of an application:.................................................3
D2: Critically Evaluation, code structure and characteristics...........................................................9
Learning outcome 3: Using an IDE, write fundamental algorithms in code.......................................10
P3: Write a program that implements an algorithm using an IDE:................................................10
M3: Use of an IDE for development of applications:............................................................................15
D3: Use the IDE to control the program's development process:........................................................16
Learning outcome 4: Importance of a coding standard and debugging process................................16
P4: Debugging procedure and IDE debugging facilities:..................................................................16
M4: Evaluate, help develop more secure debugging, robust applications:.....................................18
D4: Evaluate why a coding standard is necessary:............................................................................18
P5: Outline the coding standard you have used in your code:.........................................................18
1
Learning outcome 1: Define basic algorithms to carry out an operation and
outline the process of programming an application.
P1: Algorithm, Explanation, Problem
An algorithm is a collection of instructions that a computer must follow in order to execute
computations or other problem-solving operations. A formal definition of an algorithm is a finite
set of instructions that must be performed in a certain order to achieve a given objective.
Characteristics:
Language independent, Finiteness, Validity, Input, Output,
2
[Accessed 22 Jul. 2022].
// function declaration
int main ()
int a = 10;
int b = 20;
int res;
std::cout << a << "+" << b << "=" << res << std::endl;
return 0;
3
}
int result;
return result;
OOP
// C++ program to implement the ATM
// Management System
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
class Bank {
// Public variables
public:
// Function to set the person's data
4
void setvalue()
{
cout << "Enter name\n";
cin.ignore();
5
cin >> amount;
}
// Function to show the balance amount
void showbal()
{
tot = tot + amount;
cout << "\nTotal balance is: " << tot;
}
// Function to withdraw the amount in ATM
void withdrawl()
{
int a, avai_balance;
cout << "Enter amount to withdraw\n";
cin >> a;
avai_balance = tot - a;
cout << "Available Balance is" << avai_balance;
}
};
// Driver Code
int main()
{
// Object of class
Bank b;
int choice;
6
// options everytime
while (1) {
cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~WELCOME~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~\n\n";
cout << "Enter Your Choice\n";
cout << "\t1. Enter name, Account "
<< "number, Account type\n";
cout << "\t2. Balance Enquiry\n";
cout << "\t3. Deposit Money\n";
cout << "\t4. Show Total balance\n";
cout << "\t5. Withdraw Money\n";
cout << "\t6. Cancel\n";
cin >> choice;
7
break;
case 4:
b.showbal();
break;
case 5:
b.withdrawl();
break;
case 6:
exit(1);
break;
default:
cout << "\nInvalid choice\n";
}
}
}
call event-handler for event_nn with event parameters else handle unrecognized event // ignore or raise
exception
end loop
8
alsion [online] Available at: https://www.assignmentexpert.com/homework-
answers/programming-and-computer-science [Accessed 19 Jul. 2022].
D2: Critically Evaluation, code structure and characteristics.
The ideas of objects and classes are fundamental to object-oriented programming. In Java,
classes are referred to as templates for objects, and objects are instances of a class, thus the
objects may inherit all of the class's traits, variables, and functions.
fact = fact * i;
cout « "Factorial of " << num « " is: " << fact << endl;
return 0;
class GFG {
9
public static void main(String[] args)
System.out.println("GfG!");
class Signup { int userid; String name; String emailid; char sex; long mob;
public void create(int userid, String name, String emailid, char sex, long mob){
this.emailid = "radha.89@gmail.com";
this.sex = 'F';
this.mob = 900558981;
Event-driven paradigms
Service oriented, Time driven
import asyncio
1p = asyncio.get_event_loop()
1p.call_soon(hello_world, 1p)
1p.run_forever() 1p.close()
#include<vector>
10
#include<stdio.h>
#include<cstring>
#include<fstream>
#include<algorithm>
class course {
char name[80],branch[50];
void input() {
cin>>reg; fflush(stdin);
11
cout<<"\t\tDisplay Records";
cout«"\n";
system("PAUSE");
system("CLS");
}; vector <course>v;
void get_file()
course x;
2 -s 2 n .
fstream f;
f.open("College.txt",ios::out);
for(int i=0;i<v.size();i++) {
(.close();
for(i=0;i<v.size();
} return ta;
12
1++) if(strcmp(v[i].name,name)==0)
Figure 1
Figure 2
13
Figure 3
Figure 4
Figure 5
14
Figure 6
Figure 7
15
elax (n.d.). [online] Available at
https://salfarisi25.wordpress.com/2010/12/22/advantage-and-disadvantage-of-
using-ide/ [Accessed 26 Jul. 2022].
Debugging facilities
Common debugging features include the ability to run or halt the target programme at specific
points, display the contents of memory, CPU registers, or storage devices (such as disc drives),
and modify memory or register contents to enter selected test data that could be the cause of
faulty programme execution. Consider running a part of code in isolation if it provides
unexpected results. Alsion (n.d.). [online] Available at: https://www.google.com/search?
q=debugging+facilities&rlz=1C1CHWL_enPK892PK892&sxsrf=ALiCzsYFy5Z5AkSwh1FFvS81G3TOSxuMRg
%3A1663741850218&ei=mq8qY6T1DKSH9u8PhMGBoAY&oq=debugg&gs_lcp=Cgdnd3Mtd2l6EAMYATIE
16
CCMQJzIECCMQJzIECCMQJzIFCAAQkQIyCggAELEDEIMBEEMyCggAELEDEIMBEEMyBQgAEIAEMgoIABCAB
BCHAhAUMgUIABCABDIKCAAQgAQQhwIQFDoHCCMQ6gIQJzoLCAAQgAQQsQMQgwE6BAgAEEM6CwguE
IAEELEDEIMBOgcIABCxAxBDSgQIQRgASgQIRhgAUPEFWPISYI4caAFwAXgAgAG_A4gB2BKSAQUzLTQuMpg
BAKABAbABCsABAQ&sclient=gws-wiz
Figure 8
Figure 9
17
M4: Evaluate, help develop more secure debugging, robust applications:
It just cannot. The process of replicating, identifying, and describing "bugs" (defects) in a system
is known as debugging.
It's a remedy after those flaws have already been introduced! At best, we may utilize analysis of
previous debugging cycles to inspire improved engineering practices and perhaps as research
towards producing better tools to be used in the software design and engineering process.
Benefits of OOP
Data Redundancy
Polymorphism Flexibility
Re-usability
Code Maintenance
Security
Easy troubleshooting
Coding standard
Encapsulation, abstraction, inheritance, and polymorphism are the four concepts of object-
oriented programming. These are daunting words for a new programmer. And Wikipedia's
complex, too long explanations may sometimes add to the confusion elax (n.d.). [online]
Available at https://www.geeksforgeeks.org/best-practices-of-object-oriented-
programming-oop/ [Accessed 22 Jul. 2022].
18