Posts

VB program to dispaly age from birth date

Image
Design Window:- Code: Private Sub cmdClear_Click()     Text1.Text = ""     Text2.Text = ""     Text1.SetFocus End Sub Private Sub cmdDisplay_Click()     Dim b As Date     Dim d As Date     Dim age As Date     b = Text1.Text     d = Format$(Now, "dd/mm/yyyy hh:mm:ss ")     age = Format$(d - b, "dd/mm/yyyy hh:mm:ss")         Text2.Text = Year(age)     Text3.Text = Month(age)     Text4.Text = Day(age)     Text5.Text = Hour(age)     Text6.Text = Minute(age)     Text7.Text = Second(age) End Sub Private Sub cmdExit_Click()     Unload Me End Sub =================================================== OUTPUT

Write a c++ program using class to read the name of user and number of units consumed and printout charges with name(Electricity)

An electricity board charges the following rates to users -for first 100 units:40p per unit -for next 200 units: 50p per unit -for beyond 300 units :60p per unit all user are charged a minimum of Rs.150. if the total cost is more than Rs.250 then an additional charges of 15% are added. write a c++ program using class to read the name of user and number of units consumed and printout charges with names.(use array of object) #include<conio.h> #include<iostream.h> class elec { char name[20]; int nou; float charge; public:void accept()        {        cout<<"\n enter name:-";        cin>>name;        cout<<"\n enter number of unit:-";        cin>>nou;        }        void calc()        { ...