Program to create a saving account using class.

This is a basic c++ program to crate a saving account using class.

 

INPUT – time, rate of interest & balance

OUTPUT – Balance after that time.

Description:

We have to take the balance, rate of interest and time [in months] as input from user and display the balance which user will have after that time interval.

 

Code:

#include<iostream>
using namespace std;
class bank
{

 static float rate;;
    static float rate1;
    static float bal;
    int time;
    int amount;
    int case1;
public:
    void getdata();
    void display();
};
float bank::rate;
float bank::bal;
float bank::rate1;

int main()
{
    bank b1,b2;
    b1.getdata();
    b1.display();
}

void bank::getdata()
{
    cout<<"Enter your current balance"<<endl;
    cin>>bal;
    cout<<"Enter the time (in months) after which you want to deposit/withdraw."<<endl;
    cin>>time;
    cout<<"Enter the rate of interest"<<endl;
    cin>>rate;
    cout<<"Choose Operation"<<endl<<"1. Withdraw"<<endl<<"2. Deposit"<<endl;
    cin>>case1;
    cout<<"Enter the amount"<<endl;
    cin>>amount;

}

void bank::display()
{
    rate1=0.01*rate;
    switch(case1)
    {
    case 1:
    bal+=(bal*rate1*time)/12-amount;
    break;

    case 2:
        bal+=(bal*rate1*time)/12+amount;
        break;

    default:
        cout<<"Invalid option."<<endl;

    }
    cout<<"Your current balance is "<<bal;

}

 

Making a table using HTML Example 2

Another example on how to make a table in html.

 

<html>
<head>
<title> CUN130101342 </title>
</head>
<body>
<table border="2">
<tr>
<th>SNO</td>
<th>Particular</td>
<th> No. of items </td>
<th> Price </td>
</tr>
<tr>
<td>1</td>
<td>Hard Disks</td>
<td>2</td>
<td>4000.00</td>
</tr>
<tr>
<td>2</td>
<td>Monitors</td>
<td>3</td>
<td>15000.00</td>
</tr>
<tr>
<td>3</td>
<td>CD ROM</td>
<td>2</td>
<td>1000.00</td>
</tr>
<tr>
<td>4</td>
<td>DVD Writers</td>
<td>4</td>
<td>6000.00</td>
</tr>
</body>
</html>