Saturday, February 21, 2015

C++ Program to find tax of person salary

Consider the following class person
class person
{
char name[20];
char addr[30];
float salary;
int property;
float tax;
public:\\method
};
calculate tax amount by checking salary and the property of the person
for salary<5000         tax rate=0
for salary>=5000||<=10000    tax rate=14% of salary
for salary>=10000        tax rate=16% of salary
in this tax amount add following amt depending on the size of area
in sqr.foot
for 100 sqr.foot        amt=0
for>1000||<5000            amt=1000
for>5000||<=10000        amt=3000


#include<conio.h>
#include<iostream.h>
class person
{
char name[20],addr[30];
float sal,tax_amt;
int prop;
public:void accept();
       void display();
};
void person::accept()
{
cout<<"\n Enter the name:-";
cin>>name;
cout<<"\n Enter address:-";
cin>>addr;
cout<<"\n Enter salary:-";
cin>>sal;
cout<<"\n Enter how much Rs. of property you have:-";
cin>>prop;
tax_amt=0;
if(sal<5000)
tax_amt=tax_amt+0;
if(sal>=5000&&sal<=10000)
tax_amt=tax_amt+(sal*0.14);
if(sal>=10000)
tax_amt=tax_amt+(sal*0.16);
if(prop==1000)
tax_amt=tax_amt+0;
if(prop>1000&&prop<5000)
tax_amt=tax_amt+1000;
if(prop>5000&&prop<=10000)
tax_amt=tax_amt+3000;
}
void person::display()
{
cout<<"\n Name:-"<<name;
cout<<"\n Address:-"<<addr;
cout<<"\n Salary:-"<<sal;
cout<<"\n Property:-"<<prop;
cout<<"\n Tax Amount:-"<<tax_amt;
}
int main()
{
person p;
clrscr();
p.accept();
p.display();
getch();
return 0;
}

=====================================================
OUTPUT :  -
Enter the name:-ABC
Enter address:-XYZ
Enter salary:-5000
Enter how much Rs. of property you have:-10000

Name:-ABC
Address:-XYZ
Salary:-5000
Property:-10000
Tax Amount:-3700

C++ program for medical shop store

C++ program for medical shop store 



Create a class medical shoppe containing

-medicine

-qty

-price

medicine details are stored into file medical.txt. when any medicine has to be sold it is first searched into file. if found the quantity is decremented that much quantity to be sold.


#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<iomanip.h>
#include<stdlib.h>
#include<stdio.h>
class medical
{
public:char med[20];
       int qty,price;
public:void accept()
       {
       cout<<"\n enter the medicine name:-";
       cin>>med;
       cout<<"\n enter qty:-";
       cin>>qty;
       cout<<"enter price";
       cin>>price;
       }
       void display()
       {
       cout<<"\n medicine name:-"<<med;
       flushall();
       cout<<"\n quantity:-"<<qty;
       cout<<"\n price:-"<<price;
       }
       void search(char n[20],int q)
       {
       int ans=1;
       ans=strcmp(med,n);
       if (ans==0)
       qty=qty-q;
       }

};
int main()
{
medical m[3];
int i,q,ans;
char n[20];
clrscr();
fstream f1;
f1.open("a.doc",ios::trunc|ios::in|ios::out);
cout<<"\n\t\tenter the details\n";
for(i=0;i<3;i++)
{
m[i].accept();
f1.write((char *)&m[i],sizeof(m[i]));
}
f1.seekg(0);
cout<<"\n enter the medicine name which is to be sold:-";
cin>>n;
cout<<"\n how much quantity you want:-";
cin>>q;
for(i=0;i<3;i++)
{
f1.read((char *)&m[i],sizeof(m[i]));
m[i].search(n,q);
f1.write((char *)&m[i],sizeof(m[i]));
}
cout<<"\n\t\t display of all records in a file\n";
for(i=0;i<3;i++)
{
f1.read((char *)&m[i],sizeof(m[i]));
m[i].display();
}

getch();
return 0;
}


--------------------------------------------------------------------

OUTPUT



                enter the details                                              
                                                                               
enter the medicine name:-per                                                   
                                                                               
enter qty:-34                                                                  
enter price 56                                                                  
                                                                               
enter the medicine name:-12                                                    
                                                                               
enter qty:-76                                                                  
enter price 45                                                                  
                                                                               
enter the medicine name:-df                                                    
                                                                               
enter qty:-34                                                                  
enter price 12                                                                  
                                                                               
enter the medicine name which is to be sold:-df                                
                                                                               
how much quantity you want:-12
                                                                               
                display of all records in a file                               
                                                                               
medicine name:-per                                                             
quantity:-34                                                                   
price:-56                                                                      
medicine name:-12                                                              
quantity:-76                                                                   
price:-45                                                                      
medicine name:-df                                                              
quantity:-22
price:-12

C++ program to accept and dispaly data using class date

Create a c++ class date which contain:
-date
-month
-year
write necessary member function to accept and display a data using
<< and >> operator

#include<iostream.h>
#include<conio.h>
class date
{
int d,m,y;
public:void accept()
       {
       cout<<"\nenter date:-";
       cin>>d;
       cout<<"\nenter month:-";
       cin>>m;
       cout<<"\nenter year:-";
       cin>>y;
       }
       void display()
       {
       cout<<"\n\ndate:="<<d<<"-"<<m<<"-"<<y;
       }
};
int main()
{
date d;
clrscr();
d.accept();
d.display();
getch();
return 0;
}


-------------------------------------------------------------------------
OUTPUT


enter date:-21

enter month:-02

enter year:-2015


date:=21-02-2015

write a c++ program to read distance from user. store it in the file and display it to the user.

Create a class  distance containing feet and inches as data member.
write a c++ program to read distance from user. store it in the file
 and display it to the user.
 use operator overloading for the following
 1.<<to write distance object in inches format to a file
 2.>>to read inches from file.

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class distance
{
   int feet;
   int inches;

 public:
 friend void operator <<(fstream &,distance &);
 friend void operator >>(fstream &,distance &);

};
void operator <<(fstream &fout,distance &d)
{
cout<<"\nEnter distance : ";
cout<<"\n\nEnter feet : ";
cin>>d.feet;
cout<<"\n\nEnter inches : ";
cin>>d.inches;
int finches=(d.feet*12)+d.inches;
fout<<finches<<"\n";
}
void operator >>(fstream &fin,distance &d)
{
int finches;
fin>>finches;
d.inches=finches%12;
d.feet=finches/12;
cout<<"\nDistance is : ";
cout<<d.feet<<" feet ";
cout<<d.inches<<" inches ";
}
int main()
{
clrscr();
fstream file;
distance d;
int n;
file.open("distance.dat",ios::out);

file.seekg(0);
cout<<"\nEnter how many distance you want to store";
cin>>n;
for(int i=0;i<n;i++)
{
file<<d;
}
file.close();
file.open("distance.dat",ios::in);
file.seekg(0);
for (i=0;i<n;i++)
{
file>>d;
}
getch();
return 0;
}

--------------------------------------------------------------------------------------
Output :-
Enter how many distance you want to store1                                     
                                                                               
Enter distance :                                                               
                                                                               
Enter feet : 2                                                                 
                                                                               
                                                                               
Enter inches : 3                                                               
                                                                               
Distance is : 2 feet 3 inches 

C++ program to find percentage of student using class student

 Write a C++ program to create a class Student which contains data members as Roll_Number, Stud_Name, Percentage.  Write member functions to accept Student information.  Display all details of student along with a class obtained depending on percentage. (Use array of objects)

#include<iostream.h>
#include<conio.h>
#include<string.h>
class student
{
    int rollno;
    char name[10];
    int no_of_sub;
    int marks_of_each_sub[10];
    float per,m1;
    public:
    student()
    {}
    student(int rno,char nm[],int no_sub)
    {
        rollno=rno;
        strcpy(name,nm);
        no_of_sub=no_sub;
        if(no_of_sub>0)
        {
        for(int i=0;i<no_of_sub;i++)
        {
        cout<<"enter the marks of subject:->";
        cin>>marks_of_each_sub[i];
        m1=m1+marks_of_each_sub[i];
        per=m1/no_of_sub;
        }
        }

    }
      void show()
      {
        cout<<"\n\t"<<rollno<<"\t"<<name<<"\t"<<no_of_sub<<"\t\t"<<per<<"\t";
        for(int i=0;i<no_of_sub;i++)
        {
        cout<<marks_of_each_sub[i];
        cout<<"\n\t\t\t\t\t\t";
        }
      }

};

void main()
{
   clrscr();
   student x[10];
   int rno,i,no;
   char nm[10];
   int no_sub;
   cout<<"\n\thow many no u want?";
   cin>>no;
   for(i=0;i<no;i++)
   {
    cout<<"\nenter the rno:->";
    cin>>rno;
    cout<<"\nenter the name:->";
    cin>>nm;
    cout<<"\nenter the no of subject:->";
    cin>>no_sub;
    x[i]=student( rno,nm,no_sub);
   }
   cout<<"\n\trollno"<<"\tname"<<"\tno_of_sub"<<"\tper"<<"\tmarks_of_each_sub";
   for(i=0;i<no;i++)
   {
    x[i].show();
   }
   getch();
}

VB program to check palindrome

Visual Basic program to check palindrome


Private Sub Command1_Click()
a = StrReverse(Text1.Text)
If a = Text1.Text Then
MsgBox "Given string is Palindrome"
Else
MsgBox "String is Not Palindrome"
End If
End Sub



Note:-A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Allowances may be made for adjustments to capital letters, punctuation, and word dividers. Famous examples include "A man, a plan, a canal, Panama!", "Amor, Roma", "race car", "taco cat", and "No 'x' in Nixon".

OR

A palindrome is any "word" which is the same forward and backward e.g. amma, radar, noon, 371173 etc.

Saturday, February 7, 2015

Program in Visual Basic for Celsius to farheniet

Dim c As Double
Dim f As Double


Private Sub CmdClr_Click()
TxtInput.Text = ""
    TxtInput.SetFocus
End Sub

Private Sub Command1_Click()
c = Val(TxtInput.Text)
If Val(c) = 0 And TxtInput = "" Then
    MsgBox "Enter Any number", vbInformation, "Result"
    TxtInput.SetFocus
    Else
    f = 9 * c \ 5 + 32
    MsgBox "Fahrenheit :" & "   " & f, vbInformation, "Result"
   
End If

End Sub

Private Sub Command2_Click()
f = Val(TxtInput.Text)
If Val(c) = 0 And TxtInput = "" Then
    MsgBox "Enter Any number", vbInformation, "Result"
    TxtInput.SetFocus
    Else
    c = (f - 32) * 5 \ 9
    MsgBox "Celsius :" & "   " & c, vbInformation, "Result"
   
End If
End Sub



Program for names of color in vb

Private Sub CmbColor_Click()
For i = 0 To CmbColor.ListCount - 1
    If CmbColor.ListIndex = i Then
        If CmbColor.List(i) = "Red" Then
            Label1.BackColor = vbRed
        ElseIf CmbColor.List(i) = "Green" Then
            Label1.BackColor = vbGreen
        ElseIf CmbColor.List(i) = "Blue" Then
            Label1.BackColor = vbBlue
        ElseIf CmbColor.List(i) = "White" Then
            Label1.BackColor = vbWhite
        Else
            Label1.BackColor = vbYellow
        End If
    End If
Next
End Sub

Private Sub CmbNames_Click()
 For i = 0 To CmbNames.ListCount - 1
    If CmbNames.ListIndex = i Then
        Label1.Caption = CmbNames.List(i)
    End If
 Next
End Sub

Private Sub Form_Load()
CmbNames.AddItem "Red Color"
CmbNames.AddItem "Green Color"
CmbNames.AddItem "Blue Color"
CmbNames.AddItem "White Color"
CmbNames.AddItem "Yellow Color"

CmbColor.AddItem "Red"
CmbColor.AddItem "Green"
CmbColor.AddItem "Blue"
CmbColor.AddItem "White"
CmbColor.AddItem "Yellow"

End Sub




menu driven program in vb

Private Sub cmdClear_Click()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text1.SetFocus
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub mnuadd_Click()
    Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub

Private Sub mnuDiv_Click()
    Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub

Private Sub mnuMult_Click()
    Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub mnusub_Click()
    Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub

Output:-



INTERNET INTRANET EXTRANET

What is Internet ?
It is a Global network of computers, (servers or clients) to exchange information.
It is a "network of networks" that includes millions of  private and public, academic, business, and government networks (local or Global),
linked by copper wires, wireless connections, and other technologies.

Hardware and Software of Internet
Variety of hardware and software are used to make Internet functional.

  • Modem
Device that enables computers to communicate through phone lines.
When we start internet the our modem communicates to modem of ISP.

  • Computer
In addition to a modem, you need a client capable of handling multiple data types.

  • Software
Two types of software’s required to enable your PC as an Internet PC.
        Communication software to establish connection
        Client software for browsing, e-mail, news.
        these software’s are provided with windows itself


Applications Of Internet :-

  1. Download programs and files
  2. E-Mail
  3. Voice and Video Conferencing
  4. E-Commerce
  5. File Sharing
  6. Information browsing
  7. Search the web addresses for access through search engine
  8. Chatting and many more…

Disadvantages of Internet:-
  1. Theft of personal information such as name, address, credit card number etc.
  2. Virus threats nothing but a program which disrupts the normal functioning of your system.
  3. Spamming refers to receiving unwanted e-mails in bulk, which provide no purpose and needlessly obstruct the entire system.
  4. Pornography This is perhaps the biggest threat related to children’s healthy mental life. A very serious issue concerning the Internet. 
Though, internet can also create havoc, destruction and its misuse can be very fatal, 
the advantages of it outweigh its disadvantages




What is Intranet ?
Internal company network that uses Internet standards (HTML, HTTP & TCP/IP protocols) & software.
Accessed only by authorized persons, especially members or employees of the organization

Intranet Security:-
Two levels of Security required:
Internal
It can be imposed by  Public Key Security & Encryption Key.
External
Through Firewall.

What is Firewall?
Security device located between firm’s internal network (intranet) & external network (internet).
Regulates access into & out of a company’s network based on a set of rules.

Note :  needs to be upgraded from time to time to check latest potential security problems.

Virtual Private Network (VPN):-
A secure connection between two points across the Internet
Tunneling:-
The process by which VPNs transfer information by encapsulating traffic in IP packets and sending the packets over the Internet




Applications of Intranet
  1. Sharing of company policies/rules & regulations
  2. Access employee database
  3. Distribution of circulars/Office Orders
  4. Access product & customer data
  5. Sharing of information  of common interest
  6. Launching of personal/departmental home pages
  7. Submission of reports 

What is Extranet?
Extranet is an Intranet for outside authorized users using same internet technology.
Inter-organizational information system.
Enable outsiders to work together with company’s employees. 
Open to selected suppliers, customers & other business partners
Corporate telephone directories

Examples..
Dealers/distributors have access to product files such as :-
  • product specification,
  • pictures,
  • images, etc.
  • to answer the queries of the customer.

Components of extranets ..
  1. Some basic infrastructure components such as the internet Including :- 
  2. TCP/IP protocols,
  3. E-mail,
  4. Web-browsers,
  5. External business partners &
  6. Tele-commuting employees place order, check status & send E-mail.


Benefits of Extranet:-
  1. Improved quality.
  2. lower travel costs.
  3. lower administrative & other overhead  costs.
  4. reduction in paperwork.
  5. delivery of accurate information on time.
  6. improved customer service.
  7. better communication.
  8. overall improvement in business effectiveness.

Disadvantages of Extranet:-
  1. The suppliers & customer who don’t have technical knowledge feel problem.
  2. Faceless contact.
  3. Information can be  misused  by other competitors.
  4. Fraud may be possible.
  5. Technical Employees are required.







Featured posts

Mongolia

 Mongolia! Mongolia is a vast and sparsely populated country in East Asia, known for its stunning natural beauty, rich history, and unique c...

Popular posts