import java.lang.*; import java.text.NumberFormat; /** Lab 3, Assignment 3 Simple program that finds the speed of a cable car between support columns (app supports an arbitrary number of columns at arbitrary postions) */ public class ass3{ public static void main(String [] args){ final int BOUNDARY_DISTANCE = 9; //distance between "near" and "far" final int SAMPLING_DISTANCE = 3; //how often to calc the current speed/position int supports[] = {0, 150, 300}; //position of the supports relative to the first int[] boundary_supports = new int[supports.length*2]; //init array with boundary positions int current_pos = 0; //current position of the car int closest_support=0; //the current closest support int closest_support_distance=100000000; double current_velocity=0; boolean inside_boundary=true; //is car inside the boundary String inside_txt; NumberFormat r = NumberFormat.getInstance(); r.setMaximumFractionDigits(2); //populate the boundary positions array for(int i=0;iboundary_supports[i-1]){ //if position is between the current and previous boundary position, then check if it's inside or outside the boundary if(i%2==0){ //if it is greater than the boundary position, check to see if it's at an even position inside_boundary=false; //if it's at an even position, then it's outside of the boundary } else{ inside_boundary=true; //if it's at an odd position, then it's inside the boundary } } } //find the closest support for(int j=0;j