directory structure change, organize by class number as opposed to mod number

Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
Amrit Panesar committed 2015-04-12 23:49:33 -07:00
1 parent 2a3d6fc042
commit 8683384387
480 files changed
+7

No files matched your search

Binary file not shown.
Binary file not shown.
+70
View File
@@ -0,0 +1,70 @@
// Amrit Panesar
// 10/01/2012
// Classwork #10 Page 618 Malik.
public class Classwork10
{
public static void main(String[] args) //main
{
int[][] alpha = new int[10][20]; //a
for(int[] row : alpha)
{
for (int coloumn : row)
{
coloumn = 5; //b
}
}
boolean bset = true;
for (int[] row : alpha)
{
for (int coloumn : row)
{
if (bset)
coloumn = 1; //c
else
coloumn = 2; //c
}
bset = false;
}
int curRow = 0;
int curCol = 1;
alpha[0][0] = 5;
for (int i=1; i<(10*20)-1; i++)
{
if (curCol == 20)
{
curCol = 0;
curRow++;
}
if (curCol == 0)
{
alpha[curRow][curCol] = alpha[curRow-1][19] *2; //d
}
else
{
alpha[curRow][curCol] = alpha[curRow][curCol-1] *2; //d
}
curCol++;
}
for (int[] row : alpha)
{
for (int coloumn : row)
{
System.out.print(coloumn + ' '); //e
}
System.out.println(); //e
}
for (int[] row : alpha)
{
for (int coloumn : row)
{
System.out.println(coloumn + ' '); //f
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
public class DebugFive2
// Prints odd numbers
// Prints new line after every 10
{
public static void main(String[] args) throws InterruptedException
{
int num, count = 0;
for(num = 1; num <= 100; num += 2)
{
System.out.print(" " + num);
++count;
if(count == 10)
{
count = 0;
System.out.println();
}
}
System.out.println("End of odd numbers");
}
}
+19
View File
@@ -0,0 +1,19 @@
public class DebugSeven4
{
public static void main(String[] args)
{
String aString = "The sly brown fox jumped over the lazy dog";
int numLetters = 0;
int stringLength = aString.length();
for(int i=0; i < stringLength; i++)
{
char ch = Character.toLowerCase(aString.charAt(i));
if(Character.isLetter(ch))
numLetters++;
}
System.out.println("The number of letters is " + numLetters);
}
}
+18
View File
@@ -0,0 +1,18 @@
public class DebugSix1
// Start with a penny
// Double it every day
// How much do you have in a month?
{
public static void main(String[] args)
{
double money = 0.01;
int day = 1;
while(day <= 31)
{
money = 2 * money;
System.out.println("After day " + day +
" you have " + money);
day++;
}
}
}
+22
View File
@@ -0,0 +1,22 @@
public class DebugSix2
// Print the character values
// of 65 through 122
{
public static void main(String[] args)
{
char letter;
int a = 0;
for(a = 65; a <= 122; a++)
{
letter = (char)a;
System.out.print(" " + letter);
if(a == 85 || a == 105)
System.out.println();
}
System.out.println("\nEnd of program");
}
}
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
import javax.swing.*;
public class FooTax
{
public static void main(String[] args) //main
{
String sMarriage = JOptionPane.showInputDialog("Are you (S)ingle, (M)arried, or (H)ead of Houshold");
char cSel = sMarriage.toLowerCase().charAt(0);
double dStdDeduct = 0.00;
if (cSel == 's')
dStdDeduct = 157.00;
else if (cSel == 'h')
dStdDeduct = 314.00;
else
{
// assume married.
String sWitholding = JOptionPane.showInputDialog("How many depedendant allowances do you claim?\n(Please enter a number)");
int iWithholdings = Integer.parseInt(sWitholding);
if (iWithholdings < 2)
dStdDeduct = 157.00;
else
dStdDeduct = 314.00;
}
JOptionPane.showMessageDialog(null,
"Your Standard Deduction is: "+dStdDeduct, //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
String sExemptions = JOptionPane.showInputDialog("How many exemption allowances do you claim?\n(Please enter a number)");
int iExemptions = 0;
try
{
iExemptions = Integer.parseInt(sExemptions);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,
"Your input was incorrect, please re-run the program", //message
"Fatal Error", //title
JOptionPane.ERROR_MESSAGE//type
);
return;
}
double dExeDeduct = 0.00;
switch (iExemptions)
{
case 0:
dExeDeduct = 0.00;
break;
case 1:
dExeDeduct = 4.68;
break;
case 2:
dExeDeduct = 9.35;
break;
case 3:
dExeDeduct = 14.03;
break;
case 4:
dExeDeduct = 18.70;
break;
case 5:
dExeDeduct = 23.38;
break;
case 6:
dExeDeduct = 28.05;
break;
case 7:
dExeDeduct = 32.73;
break;
case 8:
dExeDeduct = 37.40;
break;
case 9:
dExeDeduct = 42.08;
break;
case 10:
dExeDeduct = 46.75;
break;
default:
dExeDeduct = (4.68 * iExemptions);
break;
}
JOptionPane.showMessageDialog(null,
"Your exemption allowance is: "+dExeDeduct, //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
}
+16
View File
@@ -0,0 +1,16 @@
/*sdgjfalkshdfjkasdhfjkdshaflkjasdhfljksAD*/
import java.util.*;
public class Foobar
{
public static void main(String[] args)
{
Calendar calendar = new GregorianCalendar();
System.out.println(calendar);
System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
}
}
+92
View File
@@ -0,0 +1,92 @@
import javax.swing.*;
public class IfGuidedExercise
{
public static void main(String[] args) //main
{
String sInput = JOptionPane.showInputDialog("Please enter a phrase.");
String input = JOptionPane.showInputDialog("Please enter a whole number.");
int iInt01 = 0;
try
{
iInt01 = Integer.parseInt(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "We're sorry, \""+input+"\" was"
+ " an incorrect input.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
if (iInt01 == 7)
{
JOptionPane.showMessageDialog(null,
"Thank You for inputting a 7", //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
if (iInt01 < 0)
{
JOptionPane.showMessageDialog(null,
"Thank You for inputting a negative number", //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
else
{
JOptionPane.showMessageDialog(null,
"Thank You for inputting a positive number", //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
if (iInt01 >= 5 && iInt01 <= 10)
{
JOptionPane.showMessageDialog(null,
"Thank You for inputting "+iInt01+", its square is: "+
Math.pow(iInt01,2), //message
"Thank You", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
if (sInput.equals("Green") && iInt01 == 7)
{
JOptionPane.showMessageDialog(null,
"Congradulations on your achievement!",
"A winner is you!", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
else
{
JOptionPane.showMessageDialog(null,
"Better luck next time.",
"Failure", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
if ((sInput.equals("White") && iInt01 == 10) ||
(sInput.equals("Blue") && iInt01 == 11) ||
(sInput.equals("Red")))
{
JOptionPane.showMessageDialog(null,
"Great color choice",
"Fabulous", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
else
{
JOptionPane.showMessageDialog(null,
"The color choice and number are not a pair.",
"Not so Fabulous", //title
JOptionPane.INFORMATION_MESSAGE //type
);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
import javax.swing.*;
public class Iterate6897
{
public static void main(String[] args) //main
{
String input = JOptionPane.showInputDialog("Please enter a large number.");
//System.out.println("Input Length = "+input.length());
String sOut ="";
int i = input.length();
try
{
Long.parseLong(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "Your input \""+input+"\" was invalid."
, "Fatal Error", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
while (i > 0)
{
char cBuf = input.charAt(i-1);
sOut += "" + cBuf;
//System.out.println(i + " - " + cBuf + " - " + sOut);
i--;
}
JOptionPane.showMessageDialog(null, "The digits reversed is: "
+sOut, "Results", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
+31
View File
@@ -0,0 +1,31 @@
import javax.swing.*;
public class Iterate7986
{
public static void main(String[] args) //main
{
String input = JOptionPane.showInputDialog("Please enter a large number.");
int iInt01 = 0;
String sOut = "";
try
{
Long.parseLong(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "Your input \""+input+"\" was invalid."
, "Fatal Error", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
for (int i=0;i<=input.length()-1;i++)
{
char cBuf = input.charAt(i);
sOut += cBuf + " ";
iInt01 += Character.getNumericValue(cBuf);
//System.out.println(cBuf + " - " + iInt01);
}
JOptionPane.showMessageDialog(null, "The summation of the digits is: "
+iInt01 + "\n" + sOut, "Results", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
+158
View File
@@ -0,0 +1,158 @@
/******************************************************************************
* Class Name: PhoneThing *
* Author: Amrit Panesar -ASP ,o/ *
* Last Edited: 09/12/2012 *
* Purpose: Takes input from a user in the form of a phone number, *
* validate input, convert from number to letters, allow numbers *
* from input to pass-thru, and ignore any whitespace/special *
* characters from user input. *
******************************************************************************/
import javax.swing.*;
public class PhoneThing
{
public static void main(String[] args) //main
{
String sN00="", sN01="", sN02="abc", sN03="def", sN04="ghi",
sN05="jkl", sN06="mno", sN07="pqrs", sN08="tuv", sN09="wxyz";
boolean quest = false;
while (true)
{
if (quest)
{
int ret = JOptionPane.showConfirmDialog(null, "Do you wish to continue?",
"Question", JOptionPane.YES_NO_OPTION);
if ( ret == JOptionPane.NO_OPTION || ret == JOptionPane.CLOSED_OPTION)
System.exit(0);
}
String input = "";
try
{
input = JOptionPane.showInputDialog("Please enter a phone number.");
input = input.toLowerCase();
}
catch (Exception e)
{
System.exit(0);
}
String sOut ="";
if (input.length() < 8)
{
JOptionPane.showMessageDialog(null, "The phone number: \""
+input+"\" was not long enough",
"Error", JOptionPane.ERROR_MESSAGE);
quest = true;
continue;
}
for (int i=0;i<=input.length()-1;i++)
{
char cBuf = input.charAt(i);
if(Character.isDigit(cBuf))
{
sOut += cBuf;
continue;
}
for (int j=0;j<=9;j++)
{
switch(j)
{
case 0:
for(int k=0;k<=sN00.length()-1;k++)
{
if(sN00.charAt(k)==cBuf)
sOut += "0";
}
break;
case 1:
for(int k=0;k<=sN01.length()-1;k++)
{
if(sN01.charAt(k)==cBuf)
sOut += "1";
}
break;
case 2:
for(int k=0;k<=sN02.length()-1;k++)
{
if(sN02.charAt(k)==cBuf)
sOut += "2";
}
break;
case 3:
for(int k=0;k<=sN03.length()-1;k++)
{
if(sN03.charAt(k)==cBuf)
sOut += "3";
}
break;
case 4:
for(int k=0;k<=sN04.length()-1;k++)
{
if(sN04.charAt(k)==cBuf)
sOut += "4";
}
break;
case 5:
for(int k=0;k<=sN05.length()-1;k++)
{
if(sN05.charAt(k)==cBuf)
sOut += "5";
}
break;
case 6:
for(int k=0;k<=sN06.length()-1;k++)
{
if(sN06.charAt(k)==cBuf)
sOut += "6";
}
break;
case 7:
for(int k=0;k<=sN07.length()-1;k++)
{
if(sN07.charAt(k)==cBuf)
sOut += "7";
}
break;
case 8:
for(int k=0;k<=sN08.length()-1;k++)
{
if(sN08.charAt(k)==cBuf)
sOut += "8";
}
break;
case 9:
for(int k=0;k<=sN09.length()-1;k++)
{
if(sN09.charAt(k)==cBuf)
sOut += "9";
}
break;
default:
{
System.out.println("ILLOGICAL!?");
System.exit(1);
}
}
}
}
String sOutput = "";
for(int i=0;i<=sOut.length()-1;i++)
{
if (i <= 6)
{
if (i == 3)
{
sOutput += "-";
}
sOutput += sOut.charAt(i);
}
}
JOptionPane.showMessageDialog(null, "The converted phone number is: "
+sOutput, "Results", JOptionPane.INFORMATION_MESSAGE);
quest = true;
}
}
}
+37
View File
@@ -0,0 +1,37 @@
import javax.swing.*;
public class PosNegZed
{
public static void main(String[] args) //main
{
String input = JOptionPane.showInputDialog("Please enter a whole number.");
int iInt01 = 0;
try
{
iInt01 = Integer.parseInt(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "We're sorry, \""+input+"\" was"
+ " an incorrect input.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
if (iInt01 > 0)
{
JOptionPane.showMessageDialog(null, "\""+input+"\" is positive.",
"Thank You", JOptionPane.INFORMATION_MESSAGE);
}
else if (iInt01 < 0)
{
JOptionPane.showMessageDialog(null, "\""+input+"\" is negative.",
"Thank You", JOptionPane.INFORMATION_MESSAGE);
}
else if (iInt01 == 0)
{
JOptionPane.showMessageDialog(null, "\""+input+"\" is zero.",
"Thank You", JOptionPane.INFORMATION_MESSAGE);
}
System.exit(0);
}
}
Binary file not shown.
Binary file not shown.
+83
View File
@@ -0,0 +1,83 @@
import javax.swing.*;
public class ThreeNonDec
{
public static void main(String[] args) //main
{
String input = JOptionPane.showInputDialog("Please enter a first whole number.");
int iInt01 = 0;
try
{
iInt01 = Integer.parseInt(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "We're sorry, \""+input+"\" was"
+ " an incorrect input.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
input = JOptionPane.showInputDialog("Please enter a second whole number.");
int iInt02 = 0;
try
{
iInt02 = Integer.parseInt(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "We're sorry, \""+input+"\" was"
+ " an incorrect input.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
input = JOptionPane.showInputDialog("Please enter a third whole number.");
int iInt03 = 0;
try
{
iInt03 = Integer.parseInt(input);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "We're sorry, \""+input+"\" was"
+ " an incorrect input.", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
String output = "";
if (iInt01 >= iInt02 && iInt02 >= iInt03)
output += "" + iInt03 + ", " + iInt02 + ", " + iInt01;
else if (iInt01 >= iInt02 || iInt02 <= iInt03)
{
if (iInt01 >= iInt03)
output += "" + iInt02 + ", " + iInt03 + ", " + iInt01;
else
output += "" + iInt02 + ", " + iInt01 + ", " + iInt03;
}
else if (iInt01 <= iInt02 || iInt02 >= iInt03)
{
if (iInt02 <= iInt03)
output += "" + iInt02 + ", " + iInt03 + ", " + iInt01;
else
output += "" + iInt02 + ", " + iInt01 + ", " + iInt03;
}
JOptionPane.showMessageDialog(null, "Your numbers in nondecending order is:\n\""+output+"\"",
"Thank You", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}