Subscribe For Free Updates!

We'll not spam mate! We promise.

Thursday 15 August 2013

Create a label named eMailLable Code in Java


This java code is for creating Lable on JFrame.

import java.awt.*;

public class EmailLabel extends java.applet.Applet {
Label eMailLabel = new Label("E-mail address: ");

public void init() {
//Add the label to the screen
add(eMailLabel);
}
}

Create a Button Named HelloButton Code in Java


Java code for creating Graphic User Interface, this code is creating a Button on JFrame

import java.awt.*;

public class SimpleButton extends java.applet.Applet {

Button helloButton = new Button("Hello World!");

public void init() {
//Add the button to the screen
add(helloButton);
}
}

Wednesday 14 August 2013

Displaying designations of employees code in C++


User enter salary of an employee and program check it while the employee is Lower Staff, Officer or Exeuctive Staff.

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

int main()
{

clrscr();
long int salary;
cout<<"\nEnter salary of employee: ";
cin>>salary;
if(salary<10000)
cout<<"\nLower Staff!";
else if(salary>=10000 && salary<30000)
cout<<"\nOfficer!";
else if(salary>=50000)
cout<<"\nExcutive level!";
else
cout<<"\nInvlaid option!!";
getch();
return 0;
}

Displaying Season Code in C++


User inputs three temperature from keyboard and program checks it individually that while the temperature occur in Winter, Spring or Summer Season and it show reasult.

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

int main()
{

clrscr();
float temp_1, temp_2, temp_3;
cout<<"\nEnter 1st temperature: ";
cin>>temp_1;
if(temp_1>=1 && temp_1<=10)
cout<<"\nWinter Season!!";
else if(temp_1>=11 && temp_1<=30)
cout<<"\nSpring Season!!";
else if(temp_1>=31 && temp_1<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
cout<<"\n\n\nEnter 2nd temperature: ";
cin>>temp_2;
if(temp_2>=1 && temp_2<=10)
cout<<"\nWinter Season!!";
else if(temp_2>=11 && temp_2<=30)
cout<<"\nSpring Season!!";
else if(temp_2>=31 && temp_2<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
cout<<"\n\n\nEnter 3rd temperature: ";
cin>>temp_3;
if(temp_3 >=1 && temp_3<=10)
cout<<"\nWinter Season!!";
else if(temp_3 >=11 && temp_3<=30)
cout<<"\nSpring Season!!";
else if(temp_3 >=31 && temp_3<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
getch();
return 0;
}

Displaying Direction code in C++


This C++ code is developed for direction, User enters two integer values from keyboard and conditional statements check it while the numbers lies in which direction.

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

int main()
{
clrscr();
int num1, num2;
cout<<"\nEnter 1st integer: ";
cin>>num1;
cout<<"\nEnter 2nd integer: ";
cin>>num2;
if(num1 >=1 && num1 <=8)
cout<<"\nThe point lies in north region and value is "<<num1;
else if(num2 >=9 && num2 <=16)
cout<<"\nThe point lies in north region and value is "<<num2;
else if(num1 >=17 && num1 <=24)
cout<<"\nThe point lies in north region and value is ";
else if(num2 >=25 && num2 <=32)
cout<<"\nThe point lies in north region and value is ";
else
cout<<"\nInvalid option!";
getch();
}

Sunday 4 August 2013

Displyaing Vowel and non vowel alphabets

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

int main()
{
clrscr();
char alphabet;

cout<<"Enter any alphabet (a-z): ";
cin>>alphabet;
if(alphabet=='a')
cout<<"\nThe alphabet "<<alphabet<<" is Vowel";
else if(alphabet=='e')
cout<<"\nThe alphabet "<<alphabet<<" is Vowel";
else if(alphabet=='i')
cout<<"\nThe alphabet "<<alphabet<<" is Vowel";
else if(alphabet=='o')
cout<<"\nThe alphabet "<<alphabet<<" is Vowel";
else if(alphabet=='u')
cout<<"\nThe alphabet "<<alphabet<<" is Vowel";
else
cout<<"\nThe alphabet "<<alphabet<<" is not Vowel";
getch();
return 0;
}