Skip to content

Instantly share code, notes, and snippets.

Bob Lutz rjlutz

Block or report user

Report or block rjlutz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rjlutz
rjlutz / Dec2Hex.java
Last active Jun 26, 2017
Loops (Chapter 5) - examples from Liang Intro to Java Comprehensive 10e
View Dec2Hex.java
import java.util.Scanner;
public class Dec2Hex {
/** Main method */
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter a decimal integer
System.out.print("Enter a decimal number: ");
@rjlutz
rjlutz / GreatestCommonDivisorMethod.java
Last active Jun 28, 2017
Methods (Chapter 6) -- examples from Liang Intro to Java Comprehensive 10e
View GreatestCommonDivisorMethod.java
import java.util.Scanner;
public class GreatestCommonDivisorMethod {
/** Main method */
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter two integers
System.out.print("Enter first integer: ");
@rjlutz
rjlutz / AnalyzeNumbers.java
Created Jul 17, 2017
Single Dimensional Arrays (Chapter 7) -- examples from Liang Intro to Java Comprehensive 10e
View AnalyzeNumbers.java
public class AnalyzeNumbers {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.print("Enter the number of items: ");
int n = input.nextInt();
double[] numbers = new double[n];
double sum = 0;
System.out.print("Enter the numbers: ");
for (int i = 0; i < n; i++) {
@rjlutz
rjlutz / CircleWithPrivateDataFields.java
Created Jul 17, 2017
Objects (Chapter 9) -- examples from Liang Intro to Java Comprehensive 10e
View CircleWithPrivateDataFields.java
public class CircleWithPrivateDataFields {
/** The radius of the circle */
private double radius = 1;
/** The number of the objects created */
private static int numberOfObjects = 0;
/** Construct a circle with radius 1 */
public CircleWithPrivateDataFields() {
numberOfObjects++;
@rjlutz
rjlutz / Bubble.pde
Last active Aug 17, 2017
A Really Simple Demonstration of Processing Using Active Mode and a Bubble Class
View Bubble.pde
public class Bubble {
int x, y;
float r;
int incrX = (int) random(4,8);
int incrY = (int) random(2,8);
int red, green, blue, alpha;
public Bubble() {
x = (int)random(width);
@rjlutz
rjlutz / Circle.pde
Last active Aug 31, 2017
ITEC 2150 Chapter 11 Inheritance
View Circle.pde
public class Circle extends Shape {
private float r; // r is the radius of the circle
public Circle(float a, float b, float c) {
super(); // this is effectively like new Shape()
x = a;
y = b;
r = c;
// accept Shape's default of filled=false
@rjlutz
rjlutz / AppleTester.java
Last active Sep 7, 2017
Inheritance and Polymorphism (Chapter 11) -- examples from Liang Intro to Java Comprehensive 10e
View AppleTester.java
public class AppleTester {
public static void main(String[] args) {
Apple apple = new Apple();
System.out.println(apple.toString());
}
}
public class Apple extends Fruit {
@rjlutz
rjlutz / FIleOutputYahooStockReport.java
Last active Sep 21, 2017
File and Web IO Examples
View FIleOutputYahooStockReport.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class FIleOutputYahooStockReport {
public static void main(String[] args) {
System.out.println("Starting ...");
@rjlutz
rjlutz / Circle.java
Last active Sep 27, 2017
Abstract Classes and Interfaces (Chapter 13) -- examples from Liang Intro to Java Comprehensive 10e
View Circle.java
public class Circle extends GeometricObject {
private double radius;
public Circle() {
}
public Circle(double radius) {
this.radius = radius;
}
View gist:4e2a84bf3000e5364dd4cb022750623e
capture json from curl or postman, like
{
"base": "USD",
"date": "2017-10-10",
"rates": {
"CAD": 1.2499,
...
...
}
}
You can’t perform that action at this time.