Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*------------------------------------------------------
- My name: Stuart Miller
- My student number: 4096514
- My email address: sfm999@uowmail.edu.au
- My subject Code: CSIT111
- Assignment number: 1
- -------------------------------------------------------*/
- 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
- class BlastSafety{
- public static void main(String[] args)
- {
- double chargeLength, stemmingLength, boreholeDiameter, explosiveDensity, factorOfSafety, depthOfBurial,safeDist; // Declaration of my variables. 'safeDist' = safeDistance. Shortened for easier coding.//
- 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.
- // 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.
- factorOfSafety = 2.0; // Current factor of safety, subject to government.
- Scanner scanner = new Scanner(System.in); // Introducing the scanner function to the program
- System.out.print("Charge length (m): "); // Scanner input allowing value to be assigned to 'chargeLength'
- chargeLength = scanner.nextDouble();
- System.out.print("Stemming length (m): "); // Scanner input allowing value to be assigned to 'stemmingLength'
- stemmingLength = scanner.nextDouble();
- System.out.print("Borehole diameter (mm): "); // Scanner input allowing value to be assigned to 'boreholeDiameter'
- boreholeDiameter = scanner.nextDouble();
- chargeLength = 1000 * chargeLength / boreholeDiameter; // Equation allowing for the value of chargeLength to be found
- 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.
- 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.
- 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
- 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.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement