Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.80 KB | None | 0 0
  1. /*------------------------------------------------------
  2. My name: Stuart Miller 
  3. My student number: 4096514
  4. My email address: sfm999@uowmail.edu.au
  5. My subject Code: CSIT111
  6. Assignment number: 1
  7. -------------------------------------------------------*/
  8.  
  9. import java.util.Scanner;   // The scanner function allows the user to input values which we can then assign it to a double data type (which we are using for this program
  10.  
  11. class BlastSafety{
  12.  
  13.     public static void main(String[] args)
  14.     {
  15.    
  16.         double chargeLength, stemmingLength, boreholeDiameter, explosiveDensity, factorOfSafety, depthOfBurial,safeDist; // Declaration of my variables. 'safeDist' = safeDistance. Shortened for easier coding.//
  17.            
  18.             explosiveDensity = 1.2;      // This is the industrial standard density for explosives used in mining blasts by this company. May be subject to change if company changes supplier.
  19.            
  20.             // These two double's could be placed either above the scanner function or below. It's not of consequence because they aren't used until we calculate depthOfBurial.
  21.            
  22.             factorOfSafety = 2.0;       // Current factor of safety, subject to government.
  23.                    
  24.         Scanner scanner = new Scanner(System.in); // Introducing the scanner function to the program
  25.                
  26.         System.out.print("Charge length (m): ");   // Scanner input allowing value to be assigned to 'chargeLength'
  27.         chargeLength = scanner.nextDouble();
  28.            
  29.         System.out.print("Stemming length (m): "); // Scanner input allowing value to be assigned to 'stemmingLength'
  30.         stemmingLength = scanner.nextDouble();
  31.        
  32.         System.out.print("Borehole diameter (mm): "); // Scanner input allowing value to be assigned to 'boreholeDiameter'
  33.         boreholeDiameter = scanner.nextDouble();
  34.        
  35.                        
  36.         chargeLength = 1000 * chargeLength / boreholeDiameter; // Equation allowing for the value of chargeLength to be found
  37.        
  38.         chargeLength = Math.min(chargeLength, 10); // Math.min() used to limit the value of chargeLength to 10, as per equation limitations. If chargeLength is greater than 10, then chargeLengthis = to 10.
  39.    
  40.         depthOfBurial = (stemmingLength + (0.0005 * chargeLength * boreholeDiameter))/( 0.00923 * Math.pow(chargeLength * Math.pow(boreholeDiameter, 3) * explosiveDensity, 0.333)); // Math.pow() allows us to insert a value and put it to the power of.
  41.                
  42.         safeDist = (factorOfSafety * 11 * (1/(Math.pow(depthOfBurial, 2.167))) * Math.pow(boreholeDiameter, 0.667) ); // Equation to calculate double safeDist(ance). Extensive use of Math.pow due to equation specifications
  43.                
  44.  
  45.         System.out.print("The blast safe distance is: " + Math.round(safeDist) + " metres."); // Due to the stipulations of the assignment, I have rounded the number down to equal the output supplied. However, in a professional setting, Math.round() will not be used due to loss of accuracy.
  46.                    
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement