Monday, January 31, 2011

Computer Specs

Hello all! First off, I'd like to welcome our newest follower, Michael Cabana! Thanks so much for helping to spread the word about this blog. I should start posting more often if I'm going to be getting more and more followers. ^.^

On to the topic at hand, so far, I've posted samples of my work in the past pertaining to Java Code, I should be able to post some XHTML in the upcoming weeks, so look forward to that, but more importantly, I wanted to share my abilities as a technician when it comes to the physical hardware we commonly call a "Personal Computer".

Since 2005, I have personally, single-handedly, and successfully assembled 2 Home Computer Systems from parts bought at a MicroBytes outlet in Pointe-Claire, installed all the corresponding software myself, and configured the systems to work properly using Windows Operating Systems. My system from 2005 has been dismantled due to lack of performance and outdated technology (R.I.P.), but my latest system is one I assembled this past Summer (2010) using Windows 7 Home Premium as the OS, though I'm attempted to install the Ubuntu Desktop 10.10 Kernel onto it, but am having trouble with the bootloading process.

Regardless, here are my currect system's technical specs:

OS: Microsoft Windows 7 Home Premium (64-bit)
Processor: AMD Athlon(tm) II X2 250 Processor 3.00 GHz
RAM Installed: 2 GB DDR3 RAM
Primary HDD: Western Digital WDC WD1001FALS-00J7B0 (1 TB)
Secondary HDD: Seagate Technology ST380011A (80 GB)
Graphics Card: ATI Radeon 5750

That's about all I can think of putting on there for now. The system itself cost me with the OS CD about $850 CDN plus change and taxes. I do plan on getting more RAM at some future point, might go with Triple-Channeling 4 GB Modules.

Stay Tuned for more updates!

~DanceLink

Monday, January 17, 2011

Updated Code

Good Morning World! As I start yet another semester learning to make new, better codes, I'd like to post an update to one of my codes I previously posted for calculating the estimate cost of items purchased after applying Sales Taxes in the Province of Quebec, Canada.

Previously, the effective sales tax in Quebec was 7.875% (QST) and the sales tax across Canada is 5% (GST), making a total tax rate of 12.875% for Sales Taxes combined in Quebec (QST+GST) for the year 2010.

Currently, the effective sales tax in Quebec is 8.925% (QST) and the sales tax across Canada is 5% (GST), making a total tax rate of 13.925% for Sales Taxes combined in Quebec (QST+GST) for the year 2011.

The following code can be used as a dummy program imitating a cash register at any general store (Grocery, Fast Food, Restaurant, etc.).

Stay tuned...

~DanceLink

-------------------------------------------------------------------------------------------------------------

import java.util.Scanner;
import java.text.NumberFormat;
public class QC_Price {

    /**
     * This program is intended to approximate the total cost of items purchased after taxes.
     * @author A. Wright
     * @version 1.1, January 2011
     */
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        double PST=0.08925, GST=0.05;
        double subtotal=0,total;
        int op1, items;
        double[] prices;
        NumberFormat currencyFormatter;
       
        System.out.println("Would you like to:"
                        +"\n1.Calculate sub-total AND total costs?"
                        +"\n2.Calculate ONLY total cost?");
        op1=kb.nextInt();
        while(op1<1||op1>2){
            System.out.println("That is not a valid option.\nPlease enter a valid option:");
            System.out.println("Would you like to:"
                    +"\n1.Calculate sub-total AND total costs?"
                    +"\n2.Calculate ONLY total cost?");
            op1=kb.nextInt();
        }
        if(op1==1){
            System.out.println("Please enter number of items to be inputed:");
            items=kb.nextInt();
            while(items<0){
                System.out.println("That is not a valid number.\nPlease enter a positive value:");
                System.out.println("Please enter number of items to be inputed:");
                items=kb.nextInt();
            }
            if(items==0){
                System.out.println("No item quantity was specified.\nSystem aborting operation.");
                System.exit(0);
            }
            prices=new double[items];
            System.out.println("Please enter item prices as advertized:");
            for(int i=0;i<items;i++){
                System.out.print((i+1)+". ");
                prices[i]=kb.nextDouble();
                subtotal += prices[i];
            }
            String currencySubtotal,currencyGST,currencyPST,currencyTotal;
            currencyFormatter=NumberFormat.getCurrencyInstance();
            currencySubtotal=currencyFormatter.format(subtotal);
            currencyGST=currencyFormatter.format(((subtotal*GST)));
            currencyPST=currencyFormatter.format(((subtotal*PST)));
            System.out.println("The subtotal amount is: "+currencySubtotal+" CDN.");
            total=subtotal+(subtotal*(GST+PST));
            currencyTotal=currencyFormatter.format(total);
            System.out.println("The total GST amount is: "+currencyGST+" CDN.");
            System.out.println("The total PST amount is: "+currencyPST+" CDN.");
            System.out.println("The total amount is: "+currencyTotal+" CDN.");
            System.exit(0);
        }
       
        if(op1==2){
        System.out.println("Please enter sub-total costs:");
        subtotal=kb.nextDouble();
        while(subtotal<0){
            System.out.println("That is not a valid price.\nPlease enter a positive value:");
            System.out.println("Please enter sub-total costs:");
            subtotal=kb.nextDouble();
        }
        total=subtotal+(subtotal*(GST+PST));
        String currencysubtotal,currencygst,currencypst,currencytotal;
        currencyFormatter=NumberFormat.getCurrencyInstance();
        currencysubtotal=currencyFormatter.format(subtotal);
        currencygst=currencyFormatter.format(((subtotal*GST)));
        currencypst=currencyFormatter.format(((subtotal*PST)));
        currencytotal=currencyFormatter.format(total);
        System.out.println("The subtotal amount is: "+currencysubtotal+" CDN.");
        System.out.println("The total GST amount is: "+currencygst+" CDN.");
        System.out.println("The total PST amount is: "+currencypst+" CDN.");
        System.out.println("The total amount is: "+currencytotal+" CDN.");
        System.exit(0);
        }
    }

}

-----------------------------------------------------------------------------------------------------------

Wednesday, January 5, 2011

Happy New Year!

Hello World!

It's a brand new year, and that entails new beginnings once again.

Here's a bit of review of some codes I've done in the past year.

Happy New Year and Welcome to 2011! ^.^

----------------------------------------------------------------------------------------------------------

import java.util.Scanner;
import java.text.NumberFormat;
public class QC_Price {

    /**
     * This program is intended to approximate the total cost of items purchased after taxes.
     * @author A. Wright
     * @version 1.0, March 2010
     */
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        double PST=0.07875, GST=0.05;
        double subtotal=0,total;
        int op1, items;
        double[] prices;
        NumberFormat currencyFormatter;
       
        System.out.println("Would you like to:"
                        +"\n1.Calculate sub-total AND total costs?"
                        +"\n2.Calculate ONLY total cost?");
        op1=kb.nextInt();
        while(op1<1||op1>2){
            System.out.println("That is not a valid option.\nPlease enter a valid option:");
            System.out.println("Would you like to:"
                    +"\n1.Calculate sub-total AND total costs?"
                    +"\n2.Calculate ONLY total cost?");
            op1=kb.nextInt();
        }
        if(op1==1){
            System.out.println("Please enter number of items to be inputed:");
            items=kb.nextInt();
            while(items<0){
                System.out.println("That is not a valid number.\nPlease enter a positive value:");
                System.out.println("Please enter number of items to be inputed:");
                items=kb.nextInt();
            }
            if(items==0){
                System.out.println("No item quantity was specified.\nSystem aborting operation.");
                System.exit(0);
            }
            prices=new double[items];
            System.out.println("Please enter item prices as advertized:");
            for(int i=0;i<items;i++){
                System.out.print((i+1)+". ");
                prices[i]=kb.nextDouble();
                subtotal += prices[i];
            }
            String currencySubtotal,currencyGST,currencyPST,currencyTotal;
            currencyFormatter=NumberFormat.getCurrencyInstance();
            currencySubtotal=currencyFormatter.format(subtotal);
            currencyGST=currencyFormatter.format(((subtotal*GST)));
            currencyPST=currencyFormatter.format(((subtotal*PST)));
            System.out.println("The subtotal amount is: "+currencySubtotal+" CDN.");
            total=subtotal+(subtotal*(GST+PST));
            currencyTotal=currencyFormatter.format(total);
            System.out.println("The total GST amount is: "+currencyGST+" CDN.");
            System.out.println("The total PST amount is: "+currencyPST+" CDN.");
            System.out.println("The total amount is: "+currencyTotal+" CDN.");
            System.exit(0);
        }
       
        if(op1==2){
        System.out.println("Please enter sub-total costs:");
        subtotal=kb.nextDouble();
        while(subtotal<0){
            System.out.println("That is not a valid price.\nPlease enter a positive value:");
            System.out.println("Please enter sub-total costs:");
            subtotal=kb.nextDouble();
        }
        total=subtotal+(subtotal*(GST+PST));
        String currencysubtotal,currencygst,currencypst,currencytotal;
        currencyFormatter=NumberFormat.getCurrencyInstance();
        currencysubtotal=currencyFormatter.format(subtotal);
        currencygst=currencyFormatter.format(((subtotal*GST)));
        currencypst=currencyFormatter.format(((subtotal*PST)));
        currencytotal=currencyFormatter.format(total);
        System.out.println("The subtotal amount is: "+currencysubtotal+" CDN.");
        System.out.println("The total GST amount is: "+currencygst+" CDN.");
        System.out.println("The total PST amount is: "+currencypst+" CDN.");
        System.out.println("The total amount is: "+currencytotal+" CDN.");
        System.exit(0);
        }
    }
}

----------------------------------------------------------------------------------------------------------

/*
 * Author: A. Wright
 * Date Written: November 12, 2010
 * Purpose: To properly print out a visual of a month according to the Gregorian Calendar.
 * Assignment: 3C
 * Class: Programming 1
 * Institution: CÉGEP Vanier College
 */

import java.util.Scanner;

public class MonthCalendar {

    static Scanner kb = new Scanner(System.in); //Scanner object   
    static int yearInput, monthInput;
   
    public static int readInt()
    {
        int inputInteger;
        while(! kb.hasNextInt())
        {
            String lineInput = kb.nextLine();
            System.out.println(lineInput+" is not a valid input. Try again...");           
            System.out.println("Please enter an integer value: ");           
        }
        inputInteger = kb.nextInt();
        return inputInteger;
    }
   
    public static int readMonth()
    {
        System.out.println("Enter a month's integer value between [1-12]: ");
        monthInput = readInt();
        while(monthInput < 1 || monthInput > 12)
        {
            System.out.println(monthInput+" is not a valid integer value, try again...");
            System.out.println("Enter a month's integer value between [1-12]: ");
            monthInput = readInt();
        }
        return monthInput;
    }
       
    public static int readYear()
    {
        System.out.println("Enter a year value greater than or equal to 1582: ");
        yearInput = readInt();
        while(yearInput < 1582)
        {
            System.out.println("That is not a valid year value, try again...");
            System.out.println("Enter a year value greater than or equal to 1582: ");
            yearInput = readInt();
        }
        return yearInput;
    }
   
    public static String getMonthName(int monthValue)
    {
        String nameOfMonth = null;
       
        switch(monthValue)
        {
        case 1:
            nameOfMonth = "January";
            break;
        case 2:
            nameOfMonth = "February";
            break;
        case 3:
            nameOfMonth = "March";
            break;
        case 4:
            nameOfMonth = "April";
            break;
        case 5:
            nameOfMonth = "May";
            break;
        case 6:
            nameOfMonth = "June";
            break;
        case 7:
            nameOfMonth = "July";
            break;
        case 8:
            nameOfMonth = "August";
            break;
        case 9:
            nameOfMonth = "September";
            break;
        case 10:
            nameOfMonth = "October";
            break;
        case 11:
            nameOfMonth = "November";
            break;
        case 12:
            nameOfMonth = "December";
            break;
        }
        return nameOfMonth;
    }
   
    public static boolean isLeapYear(int year)
    {
        boolean isLeapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
        return isLeapYear;
    }
   
    public static int getDaysInMonth (int month,int year)
     {
        int daysInMonth = 0;

        switch (month)
          {
             case 1: case 3: case 5: case 7: case 8: case 10: case 12: daysInMonth = 31; break;
             case 2:
                 if(isLeapYear(year))
                 {
                     daysInMonth = 29;
                 }
                 else
                     daysInMonth = 28;
                 break;
             default : daysInMonth = 30; break;

          }
           return daysInMonth;
      }
   
    public static int zeller(int month, int day, int year)
    {
       
        int d = day;
        int m = 0;
       
        switch(month)
        {
        case 1:
            m = 11;
            break;
        case 2:
            m = 12;
            break;
        case 3:
            m = 1;
            break;
        case 4:
            m = 2;
            break;
        case 5:
            m = 3;
            break;
        case 6:
            m = 4;
            break;
        case 7:
            m = 5;
            break;
        case 8:
            m = 6;
            break;
        case 9:
            m = 7;
            break;
        case 10:
            m = 8;
            break;
        case 11:
            m = 9;
            break;
        case 12:
            m = 10;
            break;
        }
        if(m == 11 || m == 12)
        {
            year -= 1;
        }
        int c = year / 100; //First 2 digits of the year
        int y = year % 100; //Last 2 digits of the year
        int z = (d + ((13 * m - 1) / 5) + y + (y / 4) + (c / 4) - (2 * c)) % 7; //Zeller's Formula
        if(z < 0)
        {
            z += 7;
        }
        return z;
    }
       
    public static void printSpace(int position)
    {
        for(int k = 0; k <= position - 1; k++)
        {
            System.out.print("     ");
        }
    }
   
    public static void printMonthAndYearCentered(String monthName, int year)
    {
        String calendarMonthYear = monthName+", "+year;
        int startingSpaces = (33/2)-(calendarMonthYear.length()/2);
        for(int k = 0; k < startingSpaces; k++)
        {
            System.out.print(" ");
        }
        System.out.println(calendarMonthYear);
    }
   
    public static void printGregorianCalendar(int month, int year)
    {
        int daysInMonth = getDaysInMonth(month, year);
        int day = 1;
        int firstDay = zeller(month, 1, year);
   
        String monthName = getMonthName(month);
   
        System.out.println();
        System.out.print("  ");
        printMonthAndYearCentered(monthName, year);
        System.out.println("\n  ---------------------------------");
        System.out.println("  Sun  Mon  Tue  Wed  Thu  Fri  Sat");
        System.out.println("  ---  ---  ---  ---  ---  ---  ---");
        printSpace(firstDay);   
        for(int w = 0 ;w <= 6 - firstDay; w++)
        {
          System.out.print("    "+ day++);
        }
        System.out.println();
        for(int y = 0; y <= 6 ; y++)
        {
           for(int x = 0; x < 7; x++)
           {
              if(day / 10 ==0)
              {
                System.out.print("    " + day++);
              }
              else
              {
                System.out.print("   " + day++);
              }
   
              if(day > daysInMonth ) break;
           }
           if(day > daysInMonth ) break;
           System.out.println();
       }
       System.out.println("\n  ---------------------------------");
    }
       
    public static void main(String[] args)
    {
        int month = readMonth();
        System.out.println("Input confirmed as valid. Continue...");
        int year = readYear();
        System.out.println("Input confirmed as valid. Retrieving Calendar archive...");
        printGregorianCalendar(month, year);       
    }   
}

-----------------------------------------------------------------------------------------------------------