Friday, August 15, 2014

Java first program, How to print something on the screen?

First, in java everything begin with class if we don't have a class then we don't have Java so class is very important and inside the class we have method. that how you going to run a program that's called method.


class first1{

}

Note- First1 is a class name. now we have created the class with name. Now I am going to write the program what I have to do.

class first1{
public static void main(String args[] ){
System.out.println("Welcome to Convict!!!");
}

}

here
method header is public static void main(String args[] )

method body is System.out.println("Welcome to Convict!!!");

print line (println) is a command that something we have print on screen.  


NOTE- Java is a case sensitive language so we have to be aware with Capital and simple Letters.


full coding

class first1{

public static void main(String args[] ){
System.out.println("Welcome to Convict!!!");
}

}


write this in notepad save this program named first1.java

then open your cmd compile your program
type javac first1.java

then run

running method
type java first1

Saturday, July 5, 2014

How to create the © symbol.

Press the "alt" key and hold it down while typing "0169" on the keyboard to create the © symbol.

Thursday, June 12, 2014

how to boot from USB pen drive ?

https://www.youtube.com/watch?v=X0M0LSd0e_0

Get drivers from the internet with amazing software

No Worries if you don't have your PC drivers
It's easy to get divers from this software it's detected the appropriate divers and find from the internet where you can download.



Click and download the software if you want to boot you computer.
http://www.drivereasy.com/

How do I know my connected WiFi password?


Click wireless network connection
2. Click wireless property 
3.there click the security tab 
4. tick the show character  

How to fix my WiFi It's say No Internet access but connected with router?

1. Click wireless network connection.


2.  Click property in Wireless Network Connection status


3.  Click the internet protocol version 4 (TCP/Ipv4) After that click the property


4. set the perfected DNS sever 8.8.8.8  and set the alternate DNS sever as 8.8.4.4 then
click ok.

https://www.youtube.com/watch?v=JOfr42IPjQ4


Sunday, June 8, 2014

Create a New Partition on a Windows 7 Hard Disk

1. Open the Disk Management console by typing diskmgmt.msc at an elevated command prompt.


2. In Disk Management’s Graphical view, right-click an unallocated or free area, and then click New Simple Volume. This starts the New Simple Volume Wizard. (Note: If you need to create unallocated space, see the Tip Easily Shrink a Volume on a Windows 7 Disk for information on how to do this.) 

3.The Specify Volume Size page specifies the minimum and maximum size for the volume in megabytes and lets you size the volume within these limits. Size the partition in megabytes using the Simple Volume Size field and then click Next

4. On the Assign Drive Letter Or Path page, specify whether you want to assign a drive letter or path and then click Next.

Wednesday, May 7, 2014

C++ codeing for Calculate your health level (Weight and Height )

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
float hi,wi,bmi;
char an;
do{
cout<<"   Enter your weight in 'kg' (kilograms): ";
cin>>wi;
cout<<endl;
cout<<"   Enter your height in 'm' (meters): ";
cin>>hi;
cout<<endl;


//calculation
bmi=wi/pow(hi,2);
cout<<"   Your bmi is "<<bmi;
cout<<endl;
if(bmi<18.5)
{
cout<<"   You are underweight.";
cout<<endl;
}

else if(bmi==18.5)
{
cout<<"   You are near underweight.";
cout<<endl;
}

else if(18.5<bmi && bmi<24.9)
{
cout<<"   You are considered normal weight.";
cout<<endl;
}

else if(24.9<bmi && bmi<29.9)
{
cout<<"   You are overweight."<<endl;
cout<<"   You may wish to consult with your physician for medical help";
cout<<endl;
}

else if(bmi==29.9)
{
cout<<"   You are near obese."<<endl;
cout<<"   You may wish to consult with your physician for medical help";
cout<<endl;
}

else if(30<bmi)
{
cout<<"   You are obese."<<endl;
cout<<"   You may wish to consult with your physician for medical help";
cout<<endl;
}
cout<<endl;
cout<<"   Do you wanna check onces more ?(Y/N)?";
cin>>an;
}while(an=='y'||an=='Y');

return 0;
}

C++ Coding for SriLanka NIC birth year finding

#include<iostream>
using namespace std;
int main()
{
int nu,s,g;
cout<<"Enter the NIC number";
cin>>nu;
// Year
s=nu/10000000%100;
cout<<"You was born in 19"<<s<<endl;
// gender
g=nu/10000%1000;
if (g<500)
{
cout<<"You are male";
}

else if(g>500)
{
cout<<"You are female";
}

return 0;
}

Friday, May 2, 2014

C++ Blood Donar and recipent program.

#include<iostream>
#include<cstring>
using namespace std;
int main()

{
char type[10],an;
cout<<"World Blood Donor Day is celebrated every 14th of June"<<endl;
cout<<"It encourages people to give blood and save lives."<<endl;
cout<<endl;
do{
cout<<"Please Enter your Blood Group here :";
cin>>type;
cout<<endl;
if(strcmp("AB+",type)==0||strcmp("ab+",type)==0 )
{
cout<<"You can donate blood to a person with type AB+."<<endl;
cout<<"You can recieve blood from anyone."<<endl;
cout<<"AB is the universal recipient. "<<endl;
}

else if(strcmp("AB-",type)==0||strcmp("ab-",type)==0)
{
cout<<"You can donate blood to a person with type AB+ or AB-."<<endl;
cout<<"You can recieve blood from O-,A-,B- and AB-."<<endl;
cout<<"AB is the universal recipient. "<<endl;

}

else if(strcmp("B+",type)==0||strcmp("b+",type)==0)
{
cout<<"You can donate blood to a person with type AB+ or B+."<<endl;
cout<<"You can recieve blood from O+,O-,B+ and B-."<<endl;

}

else if(strcmp("B-",type)==0||strcmp("b-",type)==0)
{
cout<<"You can donate blood to a person with type B+,B-,AB+ and AB-."<<endl;
cout<<"You can recieve blood from O- and B-."<<endl;

}
else if(strcmp("A+",type)==0||strcmp("a+",type)==0)
{
cout<<"You can donate blood to a person with type A+ or AB+."<<endl;
cout<<"You can recieve blood from O+,O-,A+ and A-."<<endl;

}
else if(strcmp("A-",type)==0||strcmp("a-",type)==0)
{
cout<<"You can donate blood to a person with type A+,A-, AB+ and AB-."<<endl;
cout<<"You can recieve blood from O- and A-."<<endl;

}

else if(strcmp("o-",type)==0||strcmp("O-",type)==0)
{
cout<<"You can donate blood to a anyone."<<endl;
cout<<"You can recieve blood from O-."<<endl;
cout<<" O is the universal donor."<<endl;


}
else if(strcmp("o+",type)==0||strcmp("O+",type)==0)
{
cout<<"You can donate blood to a person with type O+,A+, B+ and AB+."<<endl;
cout<<"You can recieve blood from O+ and O-."<<endl;
cout<<" O is the universal donor."<<endl;

}
else
{
cout<<"Invaild type of group, try again";
}

cout<<endl;
cout<<"Do you wanna check another blood group? (Y,N)";
cin>>an;
}while(an=='y'||an=='Y');



return 0;
}

Thursday, April 3, 2014

How to Track Your Flight Status With Google?

Google provide the live flight state information of any flight in the world.

All you have to do is just type your flight no in google.


You will all information you need filght company name destination landed time etc.   

How to block facebook from your google chrome?

You can see the file named hosts in blow path.
C:\Windows\System32\Drivers\etc
You have to edit in follow method.

Open the notepad program right click run as administrator.
click the file then click open hosts file from following location.
C:\Windows\System32\Drivers\etc.


You can see the IP address in last line
127.0.0.1

You can add the web address or URLs after IP address what you have to block.
if I want to block FACE BOOK
I should type 127.0.0.1 facebook.com.

Wednesday, March 12, 2014

Saturday, March 8, 2014

Array Fundamentals (How to store multiple values)

#include<iostream>
using namespace std;
int main()
{
int a[5];
for(int j=1;6>j;j++)
{
cout<<"Enter the age";
cin>>a[j];
}

for(int j=1;6>j;j++)
{
cout<<"you entered"<<a[j]<<endl;
}
return 0;
}

Friday, March 7, 2014

2013 SLIIT Midterm Answers ( IPE_C_Unix_IT101_1a ) Question 02

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int a,t,t1;
cout<<"Enter the number: ";
cin>>a;

for(int n=1;n<=a;n++ )
{
t=pow(n,n);
t1=t1+t;
}
cout<<t1;

return 0;
}

Wednesday, March 5, 2014

C++ ( setw ) How to leave a space between two words.

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout<<"SriLanka"<<setw(25)<<"Australia"<<endl;
return 0;
}

C++ 2 to the power 3 (Exponent Function)

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
cout<<pow(2,3)<<endl;
return 0;
}

C++ For Loop 1,4,9,16....n

#include<iostream>
using namespace std;
int main()
{
for(int n=0;n<10;n++)
{
cout<<n*n<<endl;
}
return 0;
}

C++ For Loop 10,20,30....n

#include<iostream>
using namespace std;
int main()
{
for(int n=0;n<100;n=n+10)
{
cout<<n<<endl;
}
return 0;
}

C ++ For Loop 1,2,3.....n

#include<iostream>
using namespace std;
int main()
{
for(int n=1;n<10;n++)
{
cout<<n<<endl;
}
return 0;
}


Monday, March 3, 2014

Law and Rules of Boolean Algebra


Commutative Law A+B = B+A
Associative Law A+(B+C) = (A+B)+C
Distributive Law A(B+C) = A.B+A.C

Sunday, March 2, 2014

2013 SLIIT Midterm Answers ( IPE_C_Unix_IT101_1a ) Question 03

#include<iostream>
using namespace std;
int main()

{

int y,a,m,t2,i1,t1,i2;
float r=10.50/100,r2=11.50/100;
cout<<"Interest method: ";
cin>>m;

if (m==1)

{
cout<<"Loan amount: ";
cin>>a;
cout<<"Number of year :";
cin>>y;
i1=a*r*y;
t1=a+i1;
cout<<"Interest amount"<<i1<<endl;
cout<<"Total amount"<<t1<<endl;
}

else if(m==2)
{
cout<<"Loan amount: ";
cin>>a;
cout<<"Number of year :";
cin>>y;
i2=t2-a;
t2=a*r2*y;
cout<<"Total amount :"<<t2<<endl;
cout<<"Interest amount :"<<i2<<endl;
}


else
{
cout<<"Invalid interest metod!";
}
return 0;
}

Saturday, March 1, 2014

Colour coding RJ 45.


  1. Crossover T568A to T568B
  2. Straight through - T568B to T568B  
 MAC and Non Mac
  • MAC -Router and computer
  • Non MAC- HUB, Switch,bridge, printer


  • None MAC to MAC – straight through
  • MAC to MAC // Non MAC to Non MAC - cross over

2013 SLIIT Midterm Answers ( IPE_C_Unix_IT101_1a ) Question 01


#include<ncurses.h>
int main()
{
int a=50;
initscr();
for(int r=5;r<19;r++)
{
for(int c=35;c<41;c++)
{
start_color();
init_pair(1,7,3);
attrset(COLOR_PAIR(1));
move(r,c);
printw("o");
}
}

for(int r=10;r<15;r++)
{
for(int c=41;c<46;c++)
{
start_color();
init_pair(2,0,4);
attrset(COLOR_PAIR(2));

move(r,c);
printw("w");
}
}

for(int r=15;r<19;r++)
{
for(int c=46;c<a;c++)
{
start_color();
init_pair(3,5,2);
attrset(COLOR_PAIR(3));

move(r,c);
printw("M");
}
a--;
}
getch();
endwin();
return 0;
}