Skip to content

Instantly share code, notes, and snippets.

import java.io.*;
import java.util.*;
public class RandomIntegerData {
public static void main(String [] args) throws IOException {
Scanner input = new Scanner(System.in);
Random randomnum = new Random();
System.out.println("Enter highest value ");
@JorgeOlvera
JorgeOlvera / Author.java
Created April 3, 2014 05:25
Author and Book classes, with their respective testing programs
//COMPILES!!!!!
/*public getters/setters: getName(), getEmail(), setEmail(), and getGender();
(There are no setters for name and gender, as these attributes cannot be changed.)
A toString() method that returns "author-name (gender) at email", e.g., "Tan Ah Teck (m) at [email protected]".*/
public class Author{
private String name;
private String email;
private char gender;
public Author (String name, String email, char gender){
public class mummy{
double height, width;
int age;
String name;
public Mummy(){
}
public double getHeight(){
public class myCircle{
int rad = 1, x, y;
MyPoint center;
double area = null;
public MyCircle(int xVal, int yVal, int rad){
rad = 1;
x = xVal;
y = yVal;
import java.util.Scanner;
import java.io.*;
public class majority {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
import java.util.Scanner;
import java.io.*;
public class farthestPair {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
import java.util.Scanner;
import java.io.*;
public class closestPair {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int c = a-1;
Random num = new Random();
/*3. Integer sort: Write a method integerSort that takes from standard input a
sequence of integers that are between 0 and 99 and prints the same
integers in sorted order on standard output. For example, presented with
the input sequence*/
import java.io.*;
import java.util.Scanner;
/* Modify the binarySearch method so that if the search key is not in the
array, it returns the largest index i for which a[i] is smaller than key (or -1 if
no such index exists).*/
import java.io.*;
import java.util.Scanner;
/*1. Write a method dedup that reads strings from standard
input and prints them on standard output with all duplicates
removed (in sorted order).*/
import java.io.*;
import java.util.Scanner;
public class dedup{
public static void main(String[] args){