Wednesday 17 January 2018

Core Java Practice Program for Beginners

Write a program to find out the number of illiterate men from the population of 80,000 people. From the total population,52% are men, out of which only 35% are literate.

Answer:- 



public class Population {

public static void main(String[] args) {
int population = 80000;
int men,literate,illiterate;
men = 52 * population / 100;
literate = 35 * men / 100;
illiterate = men - literate ;
System.out.println("------------------------------------------------");
System.out.println("Total Men ="+men);
System.out.println("Total literate men ="+literate);
System.out.println("Total illiterate men ="+illiterate);
System.out.println("------------------------------------------------");
}

}

Tuesday 16 January 2018

Core Java Practice Program

Arnold wants to write program to convert the temperature from Celsius to Fahrenheit. To calculate the temperature, Arnold use the following formula:-

                      F = C *9/5 +32

Here, C is the temperature in Celsius and F is the temperature in Fahrenheit.Help Arnold to perform desired task.


Answer:-



public class TemperatureConversion {

public static void main(String[] args) {
double c;
double f;
c=89;
f= c * 9/5 + 32;
System.out.println("------------------------------------------");
System.out.println("Temperature in Fahrenheit ="+f);
System.out.println("------------------------------------------");
}

}

Core Java Practice Problem

Mary Needs To Write A Program To Calculate The Volume Of The Cylinder. To Calculate The Volume Of The Cylinder,Mary Needs To Use The Following Formula

                      Volume =
π
r
2h

Here, r is the radius of the cylinder, h is the height of the cylinder and the value of pie is 3.14. Help Mary To Perform Desired Task.

  

Answer:-


public class VolumeOfTheCylinder 
{

public static void main(String[] args) 
         {
int r, h;
double volume;
r = 6;
h = 15;
volume = 3.14 * r* r*h;
System.out.println("----------------------------------------");
System.out.println("Volume  ="+volume);
System.out.println("----------------------------------------");
 }

}





 

Core Java Practice Program

John Needs To Write A Program To Calculate The Total Distance Travelled By A Vehicle. To Calculate The Distance, John  Can Use The Following Formula:- 

                     Distance = ut + (at2)/2

Here, u is the initial velocity (meters per second),  a is the acceleration(meter per second2), and t is the time(seconds). Help John to perform desired task.


Answer:-


public class Distance {

public static void main(String[] args) {
int u , a , t , distance;
u = 23;
a= 7;
t= 12;
distance = u * t + (a * t * t )/2;
System.out.println("-----------------------------------");
System.out.println("Distance Travelled ="+distance + "meter");
System.out.println("-----------------------------------");
}

}

       

Error While embed the video in Your website page

Error:- Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin Solution:- if ...