Skip to content

Instantly share code, notes, and snippets.

@AndresRodz
AndresRodz / MyCircle.java
Created March 24, 2014 06:10
MyCircle Class
public class MyCircle {
//Instance Variables
int radius = 1;
int x;
int y;
MyPoint center;
double area = null;
public MyCircle(int xValue, int yValue, int radius) {
x = xValue;
@AndresRodz
AndresRodz / Majority.java
Created March 13, 2014 01:23
CS II 2nd Partial Laboratory Problem 6
import java.util.Scanner;
public class Majority {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int positions = input.nextInt();
int[] myarray;
int[] newarray = new int[positions];
for (int i=0; i < newarray.length; i++) {
@AndresRodz
AndresRodz / FarthestPair.java
Created March 13, 2014 01:23
CS II 2nd Partial Laboratory Problem 5
import java.util.Scanner;
public class FarthestPair {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int positions = input.nextInt();
int[] myarray;
int[] newarray = new int[positions];
for (int i=0; i < newarray.length; i++) {
@AndresRodz
AndresRodz / ClosestPair.java
Created March 13, 2014 01:22
CS II 2nd Partial Laboratory Problem 4
import java.util.Scanner;
public class ClosestPair {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int positions = input.nextInt();
int[] myarray;
int[] newarray = new int[positions];
for (int i=0; i < newarray.length; i++) {
@AndresRodz
AndresRodz / IntegerSort.java
Created March 13, 2014 01:22
CS II 2nd Partial Laboratory Problem 3
import java.util.Scanner;
public class IntegerSort {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
integerSort();
}
public static void integerSort() {
Scanner input = new Scanner(System.in);
@AndresRodz
AndresRodz / ModifiedBinarySearch.java
Created March 13, 2014 01:21
CS II 2nd Partial Laboratory Problem 2
import java.util.Scanner;
public class ModifiedBinarySearch {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
BinarySearch();
}
public static int BinarySearch(int[] myarray, int key) {
int mid;
int low = 0;
@AndresRodz
AndresRodz / dedup.java
Created March 13, 2014 01:20
CS II 2nd Partial Laboratory Problem 1
import java.util.Scanner;
public class dedup {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
dedup();
}
public static void dedup() {
Scanner input = new Scanner(System.in);
System.out.println("Please introduce the number of strings you wish to sort:");
@AndresRodz
AndresRodz / LandBSearch.java
Created March 5, 2014 05:57
Linear and Binary Searching
import java.util.*;
import java.util.Scanner;
import java.util.Arrays;
public class LandBSearch {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Random randomGenerator = new Random();
@AndresRodz
AndresRodz / ReplaceNumber.java
Created February 21, 2014 00:18
Andres Rodriguez A01193126, Hector Carpizo A01193092
import java.util.Scanner;
import java.util.*;
public class ReplaceNumber {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
Random randomGenerator = new Random();
System.out.println("Please introduce the rows and columns you want to fill");
int x = input.nextInt();
int y = input.nextInt();
@AndresRodz
AndresRodz / RainFall.java
Created February 21, 2014 00:17
Andres Rodriguez A01193126, Hector Carpizo A01193092
import java.util.Scanner;
public class RainFall {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
Double[][] rain = InputData();
HighestRainFall(rain);
TotalRainfall(rain);
TotalRainfallWeek(rain);
Days(rain);