Purpose:
Since the pressure chamber is suffering from water leakage, it will be useful to analyze the area of the leakage the purpose of this program is to present an automatic analysis on the severity of leakage.
import java.util.*; public class flowrate { public static void main (String[] args) { double height, volume, time, diameter, rate, velocity, area; Scanner scan = new Scanner (System.in); int choice; System.out.println("This program will provide calculation for the severity of the leakage around the given parameter: "); System.out.println("1. Lid: "); System.out.println("2. Leakage around user defined height: "); choice = scan.nextInt(); if (choice == 1) { System.out.println("Please indicate the height of water: "); height = scan.nextDouble(); System.out.println("Please indicate the time it takes to drain the pipe: "); time = scan.nextDouble(); System.out.println("Please indicate the diameter of pipe: "); diameter = scan.nextDouble(); volume = (diameter / 2) * (diameter / 2) * Math.PI; rate = volume / time; velocity = Math.sqrt(2*9.81*height); area = rate / velocity; System.out.println("The area of the leakage is around: " +area +"cm square"); } } public static void waiting (int n) { long t0, t1; t0 = System.currentTimeMillis(); do{ t1 = System.currentTimeMillis(); } while (t1 - t0 < n); } }