You are on page 1of 4

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package dowhileeleazar;

import java.util.Scanner;

/**

* @author Eleazar

*/

public class DowhileEleazar {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Scanner input =new Scanner(System.in);

double S, E, psi, mmHg, ftH2O, bar;

System.out.print("Please enter the starting pressure in psi: ");

S = input.nextDouble();

System.out.print("Please enter the ending pressure value in psi: ");

E = input.nextDouble();

System.out.print("\n psi mmHg ftH2O bar\n");

psi=S;

do

mmHg = psi*(760/14.7);

ftH2O = psi*(33.899/14.7);

bar = psi*(101325/(14.7*100000));

System.out.printf("\n%11.4f %11.4f %11.4f %11.4f ",psi,mmHg,ftH2O,bar);

psi = psi + 5.0;

}
while

(psi!=(E+5.0));

}
If and else statements

package helloengineerjerard1;

import java.util.Scanner;

/**

* @author Eleazar

*/

public class HelloEngineerJerard1 {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Scanner input = new Scanner (System.in);

double Re, D, V, Density, Viscosity;

System.out.print("ENTER DIAMETER IN METERS: ");

D = input.nextDouble();

System.out.print("ENTER VELOCITY IN m/s^2: "):

V = input.nextDouble();

System.out.print("ENTER DENSITY IN kg/m^3: ");

Density = input.nextDouble();

System.out.print("ENTER VISCOSITY IN Pa-s: ");

Viscosity = input.nextDouble();

Re = (D*V*Density)/Viscosity;

System.out.println("The Value of Reynold's number is: " + Re );

if (Re > 2500)

{if (Re < 4000)

System.out.println("THE VALUE OF REYNOLD'S NUMBER IS: "+ Re);

System.out.println("THE FLOW IS TRANSITION");

else{

System.out.println("THE VALUE OF REYNOLD'S NUMBER IS: " + Re);


System.out.println("THE FLOW IS TURBULENT");

else

{System.out.println("THE VALUE OF REYNOLD'S NUMBER IS: " +Re);

System.out.println("THE FLOW IS LAMINAR");

You might also like