Archives from S:\ Drive
Good to keep around methinks
This commit is contained in:
1 parent
eadaf70b9e
commit
6dd63cc439
606 files changed
+50212
No files matched your search
@@ -0,0 +1,51 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1b *
|
||||
* Class Name: Numbers *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/08/2012 *
|
||||
* Hours: 0.25 Hours *
|
||||
* Purpose: To declare variables, constant variables, explore promotions *
|
||||
* explicit type casting, and display the results of these *
|
||||
* activities. *
|
||||
******************************************************************************/
|
||||
|
||||
public class Numbers // direction 1
|
||||
{
|
||||
public static void main(String[] args) // main
|
||||
{
|
||||
int iNumberTwo = 765, iNumberThree = (int) 4.75, iNumberFour = 17, iNumberFive = -2; // direction a + b
|
||||
final int iNumberOne = 3; // as per directon a + c: iNumberOne must be constant
|
||||
double dRealOne = 54.3, dRealTwo = 85, dRealThree = 67.56, dRealFour = 2, dRealFive = 3.3; // direction d + e
|
||||
|
||||
System.out.println("NumberOne stores " + iNumberOne); //direction f
|
||||
System.out.println("NumberTwo stores " + iNumberTwo); //f
|
||||
System.out.println("NumberThree stores " + iNumberThree); //f
|
||||
System.out.println("NumberFour stores " + iNumberFour); //f
|
||||
System.out.println("NumberFive stores " + iNumberFive); //f
|
||||
System.out.println("RealOne stores " + dRealOne); //f
|
||||
System.out.println("RealTwo stores " + dRealTwo); //f
|
||||
System.out.println("RealThree stores " + dRealThree); //f
|
||||
System.out.println("RealFour stores " + dRealFour); //f
|
||||
System.out.println("RealFive stores " + dRealFive); //f
|
||||
System.out.println("** Number Three is type casted as an integer"); // direction g
|
||||
System.out.println("** Real Two is implicitly promoted as a double"); // direction h
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
|
||||
E:\programs\Mod1\Project1>java Numbers
|
||||
NumberOne stores 3
|
||||
NumberTwo stores 765
|
||||
NumberThree stores 4
|
||||
NumberFour stores 17
|
||||
NumberFive stores -2
|
||||
RealOne stores 54.3
|
||||
RealTwo stores 85.0
|
||||
RealThree stores 67.56
|
||||
RealFour stores 2.0
|
||||
RealFive stores 3.3
|
||||
** Number Three is type casted as an integer
|
||||
** Real Two is implicitly promoted as a double
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,63 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1c *
|
||||
* Class Name: Numbers *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/09/2012 *
|
||||
* Hours: 0.25 Hours *
|
||||
* Purpose: To declare variables, constant variables, explore promotions *
|
||||
* explicit type casting, and display the results of these *
|
||||
* activities. *
|
||||
******************************************************************************/
|
||||
|
||||
public class Precedence // direction a
|
||||
{
|
||||
public static void main(String[] args) // main
|
||||
{
|
||||
int iAmFour = 4, iAmTwo = 2, iAmSeven = 7, iAmFourteen = 14, iAmEightteen = 18, iAmFive = 5, iAmOne = 1, iAmTwentyEight = 28, iAmTwenty = 20, iAmThree = 3; // direction a
|
||||
double iAmPointTwo = 0.2; // direction a
|
||||
System.out.println( iAmFour + " + " + iAmSeven + " * " + iAmFour + " = " + (iAmFour+iAmSeven*iAmFour) ); // comp 1
|
||||
System.out.println( iAmFour + " / " + iAmTwo + " * " + iAmFourteen + " = " + (iAmFour/iAmTwo*iAmFourteen) ); // comp 2
|
||||
System.out.println( iAmEightteen + " / " + iAmTwo + " + " + iAmFourteen + " / " + iAmTwo + " = " + (iAmEightteen/iAmTwo+iAmFourteen/iAmTwo) ); // comp 3
|
||||
System.out.println( iAmFour + " + " + iAmTwo + " / " + iAmFour + " - " + iAmTwo + " = " + (iAmFour+iAmTwo/iAmFour-iAmTwo) ); // comp 4
|
||||
System.out.println( iAmFive + " % " + iAmTwo + " * " + iAmFour + " / " + iAmOne + " + " + iAmFive + " = " + (iAmFive%iAmTwo*iAmFour/iAmOne+iAmFive) ); // comp 5
|
||||
System.out.println( iAmTwentyEight + " / " + iAmFive + " = " + (iAmTwentyEight/iAmFive) ); // comp 6
|
||||
System.out.println( iAmTwentyEight + " % " + iAmFive + " = " + (iAmTwentyEight%iAmFive) ); // comp 7
|
||||
System.out.println( iAmTwenty + " / ( " + iAmFour + " + " + iAmOne + " ) = " + (iAmTwenty/(iAmFour+iAmOne)) ); // comp 8
|
||||
System.out.println( "( " + iAmTwo + " + " + iAmThree + " ) * " + iAmFour + " = " + ((iAmTwo+iAmThree)*iAmFour) ); // comp 9
|
||||
System.out.println( "24 / " + iAmPointTwo + " = " + (24/iAmPointTwo) ); // comp 10
|
||||
System.out.println( "----------------------------------------------------------------------------------------" );
|
||||
System.out.println( "Order of Precedence:" ); // direction c
|
||||
System.out.println( "1) Parentheses." ); // c
|
||||
System.out.println( "2) Multiplication, Division, Modulo - Left to Right." ); // c
|
||||
System.out.println( "3) Addition, Subtraction - Left to Right." ); // c
|
||||
System.out.println( "4) Assignment - Right to Left." ); // c
|
||||
System.out.println( "Multiplicative Operators are assosciated from Left to Right" ); // direction d
|
||||
System.out.println( "Addative Operators are assosciated from Left to Right" ); // d
|
||||
System.out.println( "Assignment Operators are assosciated from Right to Left" ); // d
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
|
||||
E:\programs\Mod1\Project1>java Precedence
|
||||
4 + 7 * 4 = 32
|
||||
4 / 2 * 14 = 28
|
||||
18 / 2 + 14 / 2 = 16
|
||||
4 + 2 / 4 - 2 = 2
|
||||
5 % 2 * 4 / 1 + 5 = 9
|
||||
28 / 5 = 5
|
||||
28 % 5 = 3
|
||||
20 / ( 4 + 1 ) = 4
|
||||
( 2 + 3 ) * 4 = 20
|
||||
24 / 0.2 = 120.0
|
||||
----------------------------------------------------------------------------------------
|
||||
Order of Precedence:
|
||||
1) Parentheses.
|
||||
2) Multiplication, Division, Modulo - Left to Right.
|
||||
3) Addition, Subtraction - Left to Right.
|
||||
4) Assignment - Right to Left.
|
||||
Multiplicative Operators are assosciated from Left to Right
|
||||
Addative Operators are assosciated from Left to Right
|
||||
Assignment Operators are assosciated from Right to Left
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,75 @@
|
||||
/*********************************************
|
||||
* Program: Project 1a *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/07/2012 *
|
||||
* Hours: 0.20 Hours *
|
||||
* Purpose: create an application that *
|
||||
* will display two of the folowing patterns *
|
||||
* ----------------------------------------- *
|
||||
* A) a 6 pointed star *
|
||||
* B) a pine tree shape composed of pound *
|
||||
* symbols *
|
||||
* C) your initals using each inital to *
|
||||
* create a large version of that letter *
|
||||
*********************************************/
|
||||
|
||||
public class Project1a // direction I
|
||||
{
|
||||
public static void main(String[] args) // direction I
|
||||
{
|
||||
String star = "\t\t\t*\n\n\t\t * * *\n\n\t\t * * * * * *\n\n\t\t * * * * * \n"+
|
||||
"\n\t\t * * * * * *\n\n\t\t * * *\n\n\t\t\t*"; // direction A -> This is the star. It is centered.
|
||||
|
||||
String pine = "\t\t\t#\n\n\t\t # #\n\n\t\t # # #\n\n\t\t # # # #\n\n\t\t\t#"; // direction B -> Pine tree like figure. Centered as well
|
||||
|
||||
String init = "\t AAA SSSSS PPPPPP \n\t AAAAA SS PP PP \n\t AA"+
|
||||
" AA SSSSS PPPPPP \n\t AAAAAAA SS PP \n\t AA AA SSSSS PP "; // direction c -> ASP. Centered.
|
||||
|
||||
String line = "\n\n--------------------------------------------------------------------------------\n\n"; // Flush.
|
||||
System.out.print(star); // Print the star
|
||||
System.out.print(line); // flush
|
||||
System.out.print(pine); // Print the pine
|
||||
System.out.print(line); // flush
|
||||
System.out.print(init); // initals
|
||||
System.out.print("\n\n"); // don't need another flush.
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
|
||||
E:\programs\Mod1\Project1>java Project1a
|
||||
*
|
||||
|
||||
* * *
|
||||
|
||||
* * * * * *
|
||||
|
||||
* * * * *
|
||||
|
||||
* * * * * *
|
||||
|
||||
* * *
|
||||
|
||||
*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
|
||||
# #
|
||||
|
||||
# # #
|
||||
|
||||
# # # #
|
||||
|
||||
#
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
AAA SSSSS PPPPPP
|
||||
AAAAA SS PP PP
|
||||
AA AA SSSSS PPPPPP
|
||||
AAAAAAA SS PP
|
||||
AA AA SSSSS PP
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,30 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1d *
|
||||
* Class Name: Strings *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/13/2012 *
|
||||
* Hours: 0.16 Hours *
|
||||
* Purpose: To declare variables, initalize, and display two strings *
|
||||
* Concarenate and display results *
|
||||
******************************************************************************/
|
||||
|
||||
public class Strings // direction 1
|
||||
{
|
||||
public static void main(String[] args) // main
|
||||
{
|
||||
String sStr1 = "String1", sStr2 = "String2", sStr3 = ""; // direction 2
|
||||
System.out.println(sStr1 + "\n" + sStr2);
|
||||
char cH0 = 'H', cE0 = 'E', cL0 = 'L', cL1 = 'L', cO0 = 'O', cSpc = ' ', cW0 = 'W', cO2 = 'O', cR0 ='R', cL3 = 'L', cD0 = 'D', cExlm = '!'; // direction 3
|
||||
sStr3 = "" + cH0 + cE0 + cL0 + cL1 + cO0 + cSpc + cW0 + cO2 + cR0 + cL3 + cD0 + cExlm + "";
|
||||
System.out.println(sStr3); // direction 3
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
|
||||
E:\programs\Mod1\Project1>java Strings
|
||||
String1
|
||||
String2
|
||||
HELLO WORLD!
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
/*********************************************
|
||||
* Program: Project 1a *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/08/2012 *
|
||||
* Hours: 0.30 Hours *
|
||||
* Purpose: create an application that *
|
||||
* will display two of the folowing patterns *
|
||||
* ----------------------------------------- *
|
||||
* A) a 6 pointed star *
|
||||
* B) a pine tree shape composed of pound *
|
||||
* symbols *
|
||||
* C) your initals using each inital to *
|
||||
* create a large version of that letter *
|
||||
*********************************************/
|
||||
|
||||
public class Project1aDub
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String star = "\t\t\t*\t\t\t*\n\n\t\t * * *\t\t * * *\n\n\t\t * * * * * *\t\t * * * * * *\n\n\t\t"+
|
||||
" * * * * * \t\t * * * * * \n\n\t\t * * * * * *\t\t * * * * * *\n\n\t\t * * *\t\t "+
|
||||
" * * *\n\n\t\t\t*\t\t\t*"; // This is the star. It is centered.
|
||||
String pine = "\t\t\t#\t\t\t#\n\n\t\t # #\t\t # #\n\n\t\t # # #\t\t # # #\n\n\t\t # #"+
|
||||
" # #\t\t # # # #\n\n\t\t\t#\t\t\t#"; // Pine tree like figure. Centered as well
|
||||
String init = "\t AAA SSSSS PPPPPP \t AAA SSSSS PPPPPP \n\t AAAAA SS PP PP "+
|
||||
"\t AAAAA SS PP PP \n\t AA AA SSSSS PPPPPP \t AA AA SSSSS PPPPPP "+
|
||||
"\n\t AAAAAAA SS PP \t AAAAAAA SS PP \n\t AA AA SSSSS PP \t "+
|
||||
" AA AA SSSSS PP "; // ASP. Centered.
|
||||
String line = "\n\n--------------------------------------------------------------------------------\n\n"; // Flush.
|
||||
System.out.print(star); // Print the star
|
||||
System.out.print(line); // flush
|
||||
System.out.print(pine); // Print the pine
|
||||
System.out.print(line); // flush
|
||||
System.out.print(init); // initals
|
||||
System.out.print("\n\n"); // don't need another line.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*********************************************
|
||||
* Program: Project 1a *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 08/08/2012 *
|
||||
* Hours: 0.30 Hours *
|
||||
* Purpose: create an application that *
|
||||
* will display two of the folowing patterns *
|
||||
* ----------------------------------------- *
|
||||
* A) a 6 pointed star *
|
||||
* B) a pine tree shape composed of pound *
|
||||
* symbols *
|
||||
* C) your initals using each inital to *
|
||||
* create a large version of that letter *
|
||||
*********************************************/
|
||||
|
||||
public class Project1aDub
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String star = "\t\t\t*\t\t\t*\n\n\t\t * * *\t\t * * *\n\n\t\t * * * * * *\t\t * * * * * *\n\n\t\t"+
|
||||
" * * * * * \t\t * * * * * \n\n\t\t * * * * * *\t\t * * * * * *\n\n\t\t * * *\t\t "+
|
||||
" * * *\n\n\t\t\t*\t\t\t*"; // This is the star. It is centered.
|
||||
String pine = "\t\t\t#\t\t\t#\n\n\t\t # #\t\t # #\n\n\t\t # # #\t\t # # #\n\n\t\t # #"+
|
||||
" # #\t\t # # # #\n\n\t\t\t#\t\t\t#"; // Pine tree like figure. Centered as well
|
||||
String init = "\t AAA SSSSS PPPPPP \t AAA SSSSS PPPPPP \n\t AAAAA SS PP PP "+
|
||||
"\t AAAAA SS PP PP \n\t AA AA SSSSS PPPPPP \t AA AA SSSSS PPPPPP "+
|
||||
"\n\t AAAAAAA SS PP \t AAAAAAA SS PP \n\t AA AA SSSSS PP \t "+
|
||||
" AA AA SSSSS PP "; // ASP. Centered.
|
||||
String line = "\n\n--------------------------------------------------------------------------------\n\n"; // Flush.
|
||||
System.out.print(star); // Print the star
|
||||
System.out.print(line); // flush
|
||||
System.out.print(pine); // Print the pine
|
||||
System.out.print(line); // flush
|
||||
System.out.print(init); // initals
|
||||
System.out.print("\n\n"); // don't need another line.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=================================================================================================================================
|
||||
|
||||
S:\programs\Mod1\Project1>java Project1aDub
|
||||
* *
|
||||
|
||||
* * * * * *
|
||||
|
||||
* * * * * * * * * * * *
|
||||
|
||||
* * * * * * * * * *
|
||||
|
||||
* * * * * * * * * * * *
|
||||
|
||||
* * * * * *
|
||||
|
||||
* *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# #
|
||||
|
||||
# # # #
|
||||
|
||||
# # # # # #
|
||||
|
||||
# # # # # # # #
|
||||
|
||||
# #
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
AAA SSSSS PPPPPP AAA SSSSS PPPPPP
|
||||
AAAAA SS PP PP AAAAA SS PP PP
|
||||
AA AA SSSSS PPPPPP AA AA SSSSS PPPPPP
|
||||
AAAAAAA SS PP AAAAAAA SS PP
|
||||
AA AA SSSSS PP AA AA SSSSS PP
|
||||
Reference in new issue
Block a user