Skip to content

Instantly share code, notes, and snippets.

import java.awt.*;
import javax.swing.JFrame;
import java.util.Scanner;
public class aCircle extends Canvas
{
public void paint( Graphics g )
{
Scanner kb = new Scanner(System.in);
g.setColor(Color.black);
@jeffreybro
jeffreybro / gist:9e50eee4f1f923b4bc61ba6f85d6101a
Created June 25, 2018 18:58
Calling code from another class - forgive the wrong use of jargon please
public class gridLines {
public void main gridLines();
{
int x = getWidth();
int y = getHeight();
int i = y;
int u = x;
for (i = 0; i <=10; i++)
{
@jeffreybro
jeffreybro / gist:edd07f81fc15421ae837238f4bde056f
Created June 18, 2018 03:13
Collatz Sequence Java code functional question: Program works when I input 999999991, but misbehaves at 999999992. Why?
import java.util.Scanner;
public class Collatz
{
public static void main (String []args)
{
Scanner keyboard = new Scanner (System.in);
System.out.print("Give me a starting number: ");
int n = keyboard.nextInt();
int even = n/2;
@jeffreybro
jeffreybro / AlphabeticalOrder.java
Created June 15, 2018 20:35
AlphabeticalOrder.java lesson 39 Programming by Doing
//The program works but I don't want it to print the integers i, ii, iii,iiii. I think it's automatically printing then when it processes the compareTo. The assignment example has it not printing those integers. Any suggestions on how to stop that?
import java.util.Scanner;
public class AlphabeticalOrder
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
String lastName = "What is your last name? ";
System.out.println(lastName);
@jeffreybro
jeffreybro / TwoMoreQuestions.java
Created June 10, 2018 03:06
TwoMoreQuestions
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main (String []args)
{
Scanner keyboard = new Scanner(System.in);
String intro1 = "TWO MORE QUESTIONS, BABY!";
String intro2 = "Think of something and I'll try to guess it.";
String question1= "Question 1) Does it belong inside or outside or both?";