Vous êtes sur la page 1sur 19

Electricity Biller &

Record Holder

Name : Gaurav Bidalia


Class : XI
Section : A
Year : 2015 - 2016

Acknowledgement
I am greatly indebted to my teacher,

Ms. Urvashi

for being with, and supporting this project by guiding


and teaching us various skills that have been deployed
within this program, thus enriching our knowledge in the
subject;
to the LearnCPP Foundation,
for providing easily available tutorials for information
upon the subject and examples for the same.

Students Signature

HOD Computers

CERTIFICATE
This is to certify that Gaurav Bidalia of Class XI - A has
prepared this report file upon the project entitled
Electricity Biller & Record Holder.
The report is a result of his efforts and endeavours. This report is
found worthy of acceptance as final project report for the subject
Computer Science of Class XI. He has prepared the report under
my guidance and evaluation.

(Ms. Urvashi)
HOD (Computer Sciences)
Department of Computer Science,
Ahlcon International School,
Mayur Vihar Ph-1, New Delhi-110092

Overview of the C++


Programming Language

The C++ programming language provides a model of memory


and computation that closely matches that of most computers.
In addition, it provides powerful and flexible mechanisms for
abstraction; that is, language constructs that allow the
programmer to introduce and use new types of objects that
match the concepts of an application. Thus, C++ supports styles
of programming that rely on fairly direct manipulation of
hardware resources to deliver a high degree of efficiency plus
higher-level styles of programming that rely on user-defined
types to provide a model of data and computation that is closer
to a humans view of the task being performed by a computer.
These higher-level styles of programming are often called data
abstraction, object-oriented programming, and generic
programming.

Linguistic Flow Chart for program

Initial code describing functions


and declaring n to have null value

While n != 4 { }
No

Yes

cin>>n;
if (n==2)
displayp/m/r

if (n==1)
cin >>c[i];

if (n==3)
cin>>ac;
No

No
Yes

Yes

if (n==4)
break;

Yes

Yes

Yes

Calculate/Display/Search on the basis of c[i] entered.


If c[i] == p use amountp(), displayp(), searchp()
If c[i] == m use amountm(), displaym(), searchm()
If c[i] == r use amountr(), displayr(), searchr()

getch()

Aim of Project

To provide an accurate and reliable means of calculating


the outcome of ones electricity bill by a means of a
program that computes the charges of the electricity
upon the basis of the consumed units of power by the
person and also the financial background.

Requirements
(Hardware and Software used)
Macbook Pro 13R (Computing Device)
(Originally experimented in: ) Xcode 7.2 [Build 7C68]
enabled with C++
(Downgraded and executed in: ) Turbo C++ - by Neutron
Pages (software)
Trackpad
Printer
Keynote (software)

Header Files
iostream.h
stdio.h
conio.h
dos.h

Functions
input() -Receiving the data of personnels in the system
amountp()-Calculations for the classes under poor section
displayp()-Display for accounts associated with poor section
searchp()-Searches by comparison of acc number among poor section
amountm()-Calculations for the classes under middle section
displaym()-Display for accounts associated with middle section
searchm()-Searches by comparison of acc number among middle section
amountr()-Calculations for the classes under rich section
displayr()-Display for accounts associated with rich section
searchr()-Searches by comparison of acc number among middle section.
main()-The main initiation of the program and the body where the rest
functions were called. This was the first to be executed.

Source Code
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
class EBill
{

private:
char name[100];
protected:
float acc;
public:
void input()
{
delay(100);
cout<<"\nEnter Your name:: ";
gets(name);
delay(100);
cout<<"\nEnter Your account no:: ";
cin>>acc;
}
void display()
{
cout<<"\nYour name is:: "<<name;
cout<<"\nYour acc_no is:: "<<acc;
}
};
class poor: public EBill
{

private:
float unit;
public:
void amountp()
{
input();
cout<<"\nEnter the amount of
electricity:: ";
cin>>unit;
}
void displayp()
{
clrscr();
display();
float k=(unit*4);
float l=(float)15/100 ;
float n=(float)k*l;
float h=(k-n);
cout<<"\nTotal bill in INR is:: "<<h;
}
int searchp(int a)
{
if(a==acc)
{
displayp();
return 1;
}
else return 0;
}
};
class mid: public EBill
{
private:
float unit;
public:
void amountm()
{
input();

cout<<"\nEnter the amount of electricity


(in Units of Kw-H):: ";
cin>>unit;
}
void displaym()
{
display();
float k=(unit*4);
float l=(float)5/100 ;
float n=(float)k*l;
float h=(k-n);

};
{

cout<<"\nTotal bill in INR is:: "<<h;


}
int searchm(float b)
{
if(b==acc)
{
displaym();
return 1;
}
else
return 0;
}
class rich: public EBill

private:
float unit;
public:
void amountr()
{
input();
cout<<"\nEnter the amount of
electricity:: ";
cin>>unit;
}
void displayr()
{
display();

};

float k=(unit*4);
cout<<"\nTotal bill in INR is:: "<<k;
}
int searchr(float c)
{
if(c==acc)
{
displayr();
return 1;
}
else return 0;
}

void main()
{
highvideo();
float ac;
int i,n,j,k,l,a;
poor p[20];
mid m[20];
rich r[20];
clrscr();
while(1)
{
clrscr();
delay(100);
cout<<"\nCode written by: Gaurav Bidalia &
Durgansh Taneja";
cout<<"\nClass : XI";
cout<<"\nSection : A";

cout<<"\nRespective Roll No.(s) : 06 & 07";


cout<<"\nYear : 2015-2016\n";
cout<<"\n**************************************
***************";
cout<<"\nELECTRICITY BILLING AND ACCOUNT
MAINTAINENCE
\n*********************************************
********";
cout<<"\n\n\n1)Input New Users\n2)Display
List of Registered Users\n3)Search using Acc
No.\n4)Exit "<<endl<<endl;
delay(500);
char c[10];
cout<<"Enter choice: ";
cin>>n;
switch(n)
{
case 1:
clrscr();
cout<<"\nHow many Users (People) do
you wish to enter? \n";
cin>>j;
for(i=0;i<j;i++)
{

cout<<"\nBased on your Financial


Background, we shall bill you.";
cout<<"\nEnter the following information
about your monthly salary => \n";
delay (1000);
cout<<"\nINR 10,000 or below: Enter 'p'";
delay (200);
cout<<"\nINR 10,000 - 50,000: Enter 'm'";
delay (200);

\n";

cout<<"\nINR 50,000 or above: Enter 'r'


cin>>c[i];
if(c[i]=='p')
p[i].amountp();
if(c[i]=='m')
m[i].amountm();
if(c[i]=='r')
r[i].amountr();
}
break;
case 2:
clrscr();
for(i=0;i<j;i++)
{
if(c[i]=='p')
p[i].displayp();
if(c[i]=='m')
m[i].displaym();
if(c[i]=='r')
r[i].displayr();
}
getch();
break;
case 3:
cout<<"\nEnter account no: ";
cin>>ac;
clrscr();
for(i=0;i<j;i++)
{
if(c[i]=='p')
{

p[i].searchp(ac);
if(a==1)
break;
}
if(c[i]=='m')
{
m[i].searchm(ac);
if(a==1)
break;
}
if(c[i]=='r')
{
r[i].searchr(ac);
if(a==1)
break;
}
}
getch();
break;
case 4:
break;
default:
cout<<"\nInvalid option\n" <<
"**************";
delay (3500);
break;
}
if(n==4)
exit(0);
}
getch();
}
/*
All values are represented for a month of usage and are billed for that
~~~~~~~~~month only~~~~~~~~~~

End of Program
*/

Output of the Program in Chronology


of Sequence
Following is the output of the source code above written as run in TurboC++ By
Neutron, simulated in a DOS box, these are the original screenshots of the program
as they run upon the software by the author of this file.

a)Menu for the functions involved in the program.

b) Input page with the details stored in the program being shown.

c) The details of the account are flashed on the screen along with calculated bill for
the month.

d) Search field accepting the account number which redirects to display its value.
The program can contain information for numerous number of accounts and this
search therefor enables quick location of the data.

Bibliography
LearnCPP Foundation :-

http://www.learncpp.com/cpp-tutorial/1-4a-a-first-look-atfunction-parameters/

Computer Science with C++ :Sumita Arora

Apple Guide to working with Xcode

Vous aimerez peut-être aussi