Skip to content

Instantly share code, notes, and snippets.

@BornRiot
BornRiot / Program.cs
Created December 16, 2017 05:54
Program class that contains Main method to run program
class Program
{
static void Main(string[] args)
{
Customer[] myCust = new Customer[3] ;
myCust[0] = new Customer();
myCust[1] = new Customer();
myCust[2] = new Customer();
@BornRiot
BornRiot / Customer.cs
Created December 16, 2017 05:47
Customer Class used to Illustrate the need to use Enums
public class Customer{
private string _Name = "";
private int _gender = 0;
public void setName(string Name)
{
this._Name= Name;
Customer[] myCust = new Customer[3] ;
myCust[0] = new Customer();
myCust[1] = new Customer();
myCust[2] = new Customer();
@BornRiot
BornRiot / Computation.java
Created May 21, 2016 13:41
Java Method to compute Factorial
<%! public long fact (long x) {
if (x == 0) return 1;
else return x * fact(x-1);
} %>
@BornRiot
BornRiot / HW6MultipleChoice
Created July 9, 2015 19:42
HW6 Problems for Java Class
/**
* Introduction to Programming HomeWork 6 Problems
*/
package javaclass;
import java.util.Arrays;
/**
* @author Marvin DaCosta a.k.a(BornRiot)
*
*/
@BornRiot
BornRiot / FarenheitToCelcius
Created September 22, 2014 03:01
Calculations for Farenheit to Celcius
/**
* Listing 2.5 in Introduction to Java by Liang. Program is used to convert Fahrenheit to Celcius
*/
package liangintrotojava9ed;
import java.util.Scanner;
/**
* @author mdacosta
*
*/
@BornRiot
BornRiot / gist:aa86ec59eee68f8f6c8e
Last active August 29, 2015 14:06
Loan Calculation Program
package liangintrotojava9ed; import java.util.Scanner;
public class ComputeLoan {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Create a Scanner
Scanner input = new Scanner(System.in);
//Enter annual interest rate in percentage e.g. 7.25%
@BornRiot
BornRiot / IntrospectionDemo.java
Created November 26, 2013 11:37
Third portion of Java Bean
package sample;
//Show properties and events.
import java.awt.*;
import java.beans.*;
public class IntrospectorDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
@BornRiot
BornRiot / ColorsBeanInfo.java
Created November 26, 2013 11:35
Second portion of Java Bean
package sample;
//A Bean information class.
import java.beans.*;
public class ColorsBeanInfo extends SimpleBeanInfo {
public PropertyDescriptor[] getPropertyDescriptors() {
try {
PropertyDescriptor rectangular = new
PropertyDescriptor("rectangular", Colors.class);
PropertyDescriptor pd[] = {rectangular};
return pd;
@BornRiot
BornRiot / Colors.java
Created November 26, 2013 11:33
First portion of Java Bean
package sample;
//A simple Bean.
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
public class Colors extends Canvas implements Serializable {
transient private Color color; // not persistent
private boolean rectangular; // is persistent
public Colors() {
addMouseListener(new MouseAdapter() {