Tuesday 1 November 2016

[PDF]Thermodynamics - An Engineers Approach 8th Edition (Yunus A. Cengel and Michael A. Boles)

Download [PDF] Thermodynamics - An Engineers Approach 8th Edition (Yunus A. Cengel and Michael A. Boles) pdf for free.

This copy of the book is available for all the engineers out there, who are out of money or can't afford this book.



Thermodynamics - An Engineers Approach 8th Edition is helpful for students studying Thermo-Fluid course or Thermodynamics course in depth.

Thermodynamics by Cengel and Boles 8th Edition is the latest edition of the book published. You can download the book from this link, It has a download link for [PDF]Thermodynamics - An Engineers Approach 8th Edition (Yunus A. Cengel and Michael A. Boles) on Google Drive and DropBox too. Just click download now below.

Download Now




Tags: cengel thermodynamics 8th edition pdf, cengel and boles thermodynamics 8th edition pdf, cengel thermodynamics 8th edition pdf download, thermodynamics an engineering approach 8th edition pdf free, thermodynamics an engineering approach 8th edition ebook, thermodynamics by cengel 8th edition pdf free download, thermodynamics an engineering approach 8th edition free download

Monday 25 July 2016

WAP: a coin flipping game | Java (Random Number Application)

Q:  WAP, You have to design a coin flipping game. In this game, the program flips the coin. If the user gets head, he earns 1 point. If tails shows up, he loses the game. After he loses ask the player if he wants to play again or quit.

Solution:
import java.util.Random;
import java.util.Scanner;
import java.util.*;
public class Coin
{
public static void main(String args[])
{
int score=0,j,i;
String k;
Random r=new Random();
Scanner s=new Scanner(System.in);
do
{ j=r.nextInt(2); if(j==1)
{
System.out.println("Head");
score++;
System.out.println("Your score: " +score);
}
else if(j==0)
{ System.out.println("Tail");
System.out.println("lose");
}
System.out.println("if you want to play");
k=s.nextLine();
}while(k.equalsIgnoreCase("yes"));
System.out.println("Your final score ");
System.out.println(score);
}
}

Tuesday 19 July 2016

Calculate Program for Addition in Java

Problem: Suppose you are at a supermarket and purchased some product, WAP to add the price of all the products. You are having only 5000, so, you need to stay in your budget.

Solution:

import java.util.*;
class Calc
{

public static void main(String args[])
{
int sum=0,num;
Scanner scan = new Scanner(System.in);
System.out.println("Start adding the number: ");

for(;;)
{
num = scan.nextInt();
sum=sum+num;
System.out.println(sum);
}
}
}

Sunday 17 July 2016

Server Program for Prime Number | Java Networking


The server is one who processes the requests or commands sent by the client for a certain operation. In this example, the server is going to check if the number provided is prime or not. It will return value as 0 or 1 to the client.

For complete explanation check this post: Java Networking: Server Client Explained [Student Friendly Explanation]

import java.net.*;
import java.io.*;
import java.util.*;

class Server1
{
public static void main(String args[]) throws IOException
{

int x,y=1,flag=0;

try{
System.out.println("Running and ready to receive number");
ServerSocket ss = new ServerSocket(1357);
Socket s = ss.accept();

DataInputStream din = new DataInputStream(s.getInputStream());
x = din.read();
System.out.println("You have entered " + x);
for(int i=2; i<x ; i++)
{
if(x%i==0){
flag++;
}}
if(flag==1){y=0;}

DataOutputStream dout = new DataOutputStream(s.getOutputStream());
dout.write(y);
dout.close();

ss.close();
}catch(UnknownHostException e)
{
System.out.println(e.getMessage());
}
}
}

Client Program for Prime Number | Java Networking



The client is one who requests or sends commands to the server for a certain operation. In this example, we are requesting the server to check if the number provided is prime or not.

For complete explanation check this post: Java Networking: Server Client Explained [Student Friendly Explanation]


import java.net.*;
import java.util.*;
import java.io.*;

class Client
{
public static void main(String args[]) throws IOException
{

int num,num1;
System.out.println("Enter a number");
Scanner scan = new Scanner (System.in);
num = scan.nextInt();

try{
System.out.println("Sending number for testing");
Socket s = new Socket("localhost",1357);

DataOutputStream dout = new DataOutputStream(s.getOutputStream());
dout.write(num);

DataInputStream din = new DataInputStream(s.getInputStream());
num1 = din.read();

if(num1==0){
System.out.println("Number is prime");
}
if(num1==1){
System.out.println("Number is not prime");
}

s.close();
}catch(UnknownHostException e)
{
System.out.println(e.getMessage());
}
}
}

Java Networking: Server Client Explained [Student Friendly Explanation]

Java networking or Server-Client is the most complicated part of Java for the student programs. I'm also a Mechatronics engineering student in Thapar University, Patiala. I have denoted a really long and sufficient time in understanding Java language in detail. So, I can understand 'The difficulty of getting basic knowledge about the topics in lectures'.

Without wasting any more time in the introduction, let us straight away get into the topic.

What is Java Networking? Basic Definition


According to Javatpoint:

Java Networking is a concept of connecting two or more computing devices together so that we can share resources. Java socket programming provides facility to share data between different computing devices.

I want to add to the statement that it is not always compulsory to have 2 different devices. We can perform and show the same example in the same device, making virtual server and client on the same device.
Today, I will explain you with the example which will run on the same computer.

Server Program: Server Program for Prime Number | Java Networking

Client Program: Client Program for Prime Number | Java Networking