Procedural Programming Assignment-Btechnd

Introduction

Procedural programming is defined as another concept based on structured programming. These procedures can be defined a part of routines, subroutines, or even functions which can be also called as functional programming. The fundamental aim of this type of programming

method is to segmentally divide a series of consequential steps which have to be acknowledged in order to achieve the desired goal of the organization. Any of the required functionalities may be called up during any given point of execution. The programming languages which are used in the procedural programming involve C. C++, Pascal etc. In this assignment, the researcher emphasises on developing and consequently evaluating a programming application which deals with the day to day  sales and purchase management of a business organization, and in turn enabling the employees to enter details of the sales and purchases as well.

LO2 : Program Design

P2.1 Identification of the data units and file structures to be implemented in the design

There exists a few data units and file structures which is a mandate in the successful development and implementation of the specified programming application. The program is desired to be developed in such a way by the researcher, in order to satisfy the requirements of the employer regarding the sales and purchase needs of the organization. The data units which are specified in the development of the code comprises of “item category”. “item price” , “item code”, “item sale”, etc. The whole code is to be designed and developed by the researcher in C++ programming language, and the code should acknowledge the implementation methodology of procedural programming.

P2.2 Programming solution to the specified problem

In this section of the assignment, the researcher has designed and implemented a code, written in C++, in order to find a suitable programming solution to the problem specified.

C++ code for management of an organization’s daily sales and purchase requirements

#include<iostream.h>

#include<conio.h>

class item

{

private:

char name[30];

int code[30];

float price[30];

int z;

public:

void add_(void);

void delete_(void);

void sell_(void);

void display_(void);

void initial(void){z=0;}

};

void item :: add_(void)

{

clrscr();

cout<<“\nEnter the category of the item : “;

cin>>name[z];

cout<<“Enter the item code       : “;

cin>>code[z];

cout<<“Enter the price of the item: “;

cin>>price[z];

z++;

}

void item :: delete_(void)

{

int i,j;

clrscr();

cout<<“\n Enter the proper item code:”;

cin>>i;

for(j=0;j<z;j++)

{

if(code[j]==i)

{

price[j]=0;

cout<<“\nThe item is deleted from the list.”;

getch();

break;

}

}

}

void item :: sell_(void)

{

char a;

int i,j;

float total_price=0;

clrscr();

cout<<“\nEnter the item code:”;

cin>>i;

for(j=0;j<z;j++)

{

if (code[j]==i)

{

if(price[j]==0)

{

cout<<“\n Sorry, there is no item left in this category.”;

cout<<“\nDo you want to buy another item? y\\n”<<endl;

cin>>a;

if (a==’y’)

{

cout<<“\nEnter the item code:”;

cin>>i;

j=-1;

}

else if (a==’Y’)

{

cout<<“\nEnter the item code:”;

cin>>i;

j=-1;

}

else

{

if (total_price!=0)

{

cout<<“\nYour total price is: “;

cout<<total_price<<” .”<<“\n Thank You Very Much”;

}

cout<<“GoodBye. Hope to see you soon again”;

break;

}

}

else

{

cout<<“Item category is: “<<name[j];

cout<<“\nItem price is   : “<<price[j]<<“tk.”<<endl;

total_price+=price[j];

price[j]=0;

cout<<“\nDo you want to buy another item:y\\n”;

cin>>a;

if (a==’y’)

{

cout<<“\nEnter the item code:”;

cin>>i;

j=-1;

}

else if (a==’Y’)

{

cout<<“\nEnter the item code:”;

cin>>i;

j=-1;

}

else

{  clrscr();

cout<<“\nYour total price is: “;

cout<<total_price<<“”<<“\n Thank You Very Much.”;

break;

}

}

}

}

getch();

}

void item :: display_()

{

int i,j=1;

clrscr();

for(i=0;i<z;i++)

{

cout<<j<<“.Item category is: “<<name[i];

cout<<“\n  Item code is    : “<<code[i];

cout<<“\n  Item price is   : “<<price[i]<<“tk.”<<endl<<endl;

j++;

}

getch();

}

int main ()

{

int i;

item business_enterprise;

clrscr();

business_enterprise.initial();

while(1)

{

cout<<“\n   What do you want to do?”<<endl;

cout<<“\n1: Add a new item.”;

cout<<“\n2: Delete an item.”;

cout<<“\n3: Sell an item.”;

cout<<“\n4: Display all items.”;

cout<<“\n5: Exit”<<endl;

cout<<“\n\n Choose a number:”;

cin>>i;

switch(i)

{

case 1:

{

business_enterprise.add_();

break;

}

case 2:

{

business_enterprise.delete_();

break;

}

case 3:

{

business_enterprise.sell_();

break;

}

case 4:

{

business_enterprise.display_();

break;

}

case 5:

{

cout<<“Good Bye! Hope to see you soon again.”;

break;

}

}

if (i==5)

break;

clrscr();

}

getch();

return 0;

}

This is the code developed for the purpose of meeting the desired requirements of the business enterprise. The output screenshots are attached as well.

Figure 1: Output Screen 1

(Source: Created by Author)

Figure 2: Output Screen 2

(Source: Created by Author)

Figure 3: Output Screen 3

(Source: Created by Author)

The program code developed for the login access panel is discussed in this section. It is developed by the researcher in C++ programming language.

C++ Code for developing a login page in the specified application

#include <iostream>
#include <string>
#include <conio.h>

int main()
{
std::string password( “” );
char temp;

std::cout << “Please enter your password -> ” << std::flush;
while( static_cast<int>( temp = getch() ) != 13 )
{
password += temp;
std::cout << ‘*’ << std::flush;
}

std::cout << std::endl << “The password entered was: ” << password << std::endl;

}

This code is basically developed for the purpose of creation of a login page in the software application, using C++ language. This code is developed in accordance with the specified requirements in the case study. It meets the aspects such as login access to the application menu and ease of accessibility for its users. The fundamental feature of this additional code is authentication of the valid users, so that unauthorized access could be stopped completely. This features also ensure a sense of safety within the organization, owing to the fact that invalid access is minimized and the specified organizational application is deemed safe from external threats of various sorts.

Thus, it can be broadly stated that, this comprises of the whole portion of the coding part which is executed in C++, acknowledging the concept of procedural programming.Order Now

 

Leave a Reply

Your email address will not be published.

1 Step 1
GET INSTANT ASSIGNMENT HELP BY PHD EXPERTS FROM UNITED KINGDOM
keyboard_arrow_leftPrevious
Nextkeyboard_arrow_right