Skip to content

Instantly share code, notes, and snippets.

View eforth's full-sized avatar

Ervin Forth eforth

View GitHub Profile
@eforth
eforth / JUTC.java
Last active April 4, 2020 19:46
Modifications made to JUTC.java
// Code above removed for brevity
public class JUTC extends Fragment {
ExpandableListView expandableListView;
List<String> ListGroup;
HashMap<String, List<String>> listItem;
MainAdapter adapter;
TextView textView;
@eforth
eforth / oop_set_2.cpp
Last active February 6, 2020 17:46
OOP Problem Set #2
/*
* Create a base class called Person that has a derived class
* called Employee. The base class must have the following
* private members: first_name, middle_initial, last_name,
* gender and birth_date. Also, the derived class must have
* the following private members: employer, salary and
* employed_date. Include getter and setter member
* functions for all private members. Write a C++ program
* that uses the Employee class to create three (3) employees
* then print their details. You may add a member function to
@eforth
eforth / Solution.java
Created November 3, 2019 18:23
Welcome to Java
public class Solution {
public static void main(String[] args) {
System.out.println("Hello, World.");
System.out.println("Hello, Java.");
}
}
@eforth
eforth / Main.java
Created October 27, 2019 16:48
HelloWorld JavaFX
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
@eforth
eforth / Countdown.java
Last active October 20, 2019 21:13
Birthday Countdaown
public class Countdown {
/*
Write a Java program that counts down how many days, hours, minutes and seconds
remain before your birthday.
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
1. Prompt the user to enter his/her birthday in following format (yyyy-mm-dd).
@eforth
eforth / Calculator.java
Created October 20, 2019 16:09
Using interfaces
interface Calculable {
double add(double num1, double num2);
double subtract(double num1, double num2);
double multiply(double num1, double num2);
}
public class Calculator implements Calculable {
@eforth
eforth / Program.java
Created October 13, 2019 19:08
OOP Concepts
import java.lang.*;
abstract class Shape {
private String color;
abstract double getArea(); // method signature
}
class Circle extends Shape {
private double radius;
@eforth
eforth / Problem3.java
Created October 6, 2019 20:30
[DEMO] Using the FOR loop
/*
Write a program that prints all multiples of 5
between 1 and 100 (including both 1 and 100).
*/
public class Problem3 {
public static void main(String[] args) {
for(int i = 1; i <= 100; i++) {
@eforth
eforth / Problem2.java
Created October 6, 2019 20:16
Decision Construct
import java.util.*;
/*
Write a program that outputs the appropriate value based on
the integer the user has entered.
Range Output
0 < n < 10 "blue”
10 < n < 20 "red”
20 < n < 30 "green”
@eforth
eforth / Main.java
Created October 6, 2019 19:06
Using the Scanner Class
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter your name: ");
String name = scan.nextLine();