This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
final int SAFE_DIST = 5; // declares main variable | |
Scanner fileName = new Scanner(System.in); // reads filename | |
System.out.print("Please enter the name of the input file: "); // output | |
Scanner inFile = new Scanner(new File(fileName.nextLine())); // reads file from filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The Frequency program outputs the frequency of each word in input | |
* file sorted alphabetically, and outputs the word with greatest frequency | |
*/ | |
import java.io.*; | |
import java.util.*; | |
public class Frequency { | |
public static void main(String[] args) throws Exception { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample input: 1 5 2 5 3 -1 -> not distinct | |
// Terminate input with a negative integer and return key | |
import java.util.*; | |
public class DuplicateCheck { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
boolean isDistinct = true; int num; | |
System.out.println("Enter sequence of numbers: "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class SafeOrbits { | |
public static void main(String[] args) throws Exception { | |
Scanner fileName = new Scanner(System.in); | |
System.out.println("Please enter filename: "); | |
Scanner inputFile = new Scanner(new File(fileName.nextLine())); | |
fileName.close(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
float sum = 0; | |
int i = 0; | |
Map<Integer, Integer> map = new HashMap<>(); | |
for (int num = 0; num >= 0;) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Distance { | |
public static void main(String[] args) throws Exception { | |
int sum = 0; | |
int[][] arr = new int[2][10]; | |
Scanner point = new Scanner(System.in); | |
System.out.print("Enter point: "); | |
for (int j = 0; point.hasNextInt(); j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package practice.eecs1021; | |
class Point { | |
private double[] coord; | |
Point (double... coord) { this.coord = coord; } | |
// get value from index | |
private double getValue(int index) { return coord[index]; } | |
// get size of array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Point { | |
public double[] coord; | |
Point (double... coord) { this.coord = coord; } | |
public double getValue(int index) { return coord[index]; } | |
public int getSize() { return coord.length; } | |
double getDistanceFrom(Point coordNew) { | |
double sum = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Objects; | |
/** | |
* A class that represents a circle. The circle is defined by its two-dimensional center point and its radius. | |
* The class allows circles to be compared using the radius of each circle. The class ensures that all circle objects will always have a radius greater than zero. | |
*/ | |
public class Circle { | |
// ATTRIBUTES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# —————————————————————————————————————————————————————————————————— # | |
# Question 1.1 # | |
# # | |
# Called via: script.sh filename1 filename2 ... # | |
# If number of files < 2, print "Error" and quit # | |
# Print which of filename1 and filename2 has larger size # | |
# —————————————————————————————————————————————————————————————————— # |
OlderNewer