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,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Project1" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Project1.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Project1-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "Project1.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=28915d98
|
||||
build.xml.script.CRC32=1e1a9662
|
||||
build.xml.stylesheet.CRC32=28e38971@1.43.1.45
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=28915d98
|
||||
nbproject/build-impl.xml.script.CRC32=778c6a17
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Project1.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=project1.Project1
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Project1</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1 *
|
||||
* Class Name: Inventory *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 1.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Inventory {
|
||||
public int iItemID;
|
||||
public String sItemName;
|
||||
public int iInStore;
|
||||
public double dManuPrice;
|
||||
public double dSellPrice;
|
||||
|
||||
public Inventory() {
|
||||
}
|
||||
|
||||
public Inventory(int iItemID, String sItemName, int iInStore, double dManuPrice, double dSellPrice) {
|
||||
this.iItemID = iItemID;
|
||||
this.sItemName = sItemName;
|
||||
this.iInStore = iInStore;
|
||||
this.dManuPrice = dManuPrice;
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public double getdManuPrice() {
|
||||
return dManuPrice;
|
||||
}
|
||||
|
||||
public void setdManuPrice(double dManuPrice) {
|
||||
this.dManuPrice = dManuPrice;
|
||||
}
|
||||
|
||||
public double getdSellPrice() {
|
||||
return dSellPrice;
|
||||
}
|
||||
|
||||
public void setdSellPrice(double dSellPrice) {
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public int getiInStore() {
|
||||
return iInStore;
|
||||
}
|
||||
|
||||
public void setiInStore(int iInStore) {
|
||||
this.iInStore = iInStore;
|
||||
}
|
||||
|
||||
public int getiItemID() {
|
||||
return iItemID;
|
||||
}
|
||||
|
||||
public void setiItemID(int iItemID) {
|
||||
this.iItemID = iItemID;
|
||||
}
|
||||
|
||||
public String getsItemName() {
|
||||
return sItemName;
|
||||
}
|
||||
|
||||
public void setsItemName(String sItemName) {
|
||||
this.sItemName = sItemName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return ""+this.getiInStore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1 *
|
||||
* Class Name: Project1 *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project1;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Project1 {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
/* ItemID itemName pInStore manufPrice sellingPrice
|
||||
* 12 Circular saw 150 $ 45.00 $ 125.00
|
||||
* 235 Cooking range 50 $ 450.00 $ 850.00
|
||||
* 301 Table saw 100 $ 125.00 $ 300.00
|
||||
* 302 Stapler 300 $ 18.00 $ 49.00
|
||||
* 303 Lawn tractor 5 $ 300.00 $ 650.00
|
||||
|
||||
*/
|
||||
public static ArrayList<Inventory> al = init();
|
||||
public static void main(String[] args) {
|
||||
// initalize - lets prime the pump.
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
doThing(iSelect);
|
||||
}
|
||||
}
|
||||
public static ArrayList<Inventory> init()
|
||||
{
|
||||
ArrayList<Inventory> al = new ArrayList<Inventory>(5);
|
||||
al.add(0, new Inventory(12,"Circular saw", 150, 45.00, 125.00));
|
||||
al.add(1, new Inventory(235,"Cooking range", 50, 450.00, 850.00));
|
||||
al.add(2, new Inventory(301,"Table saw", 100, 125.00, 300.00));
|
||||
al.add(3, new Inventory(302,"Stapler\t", 300, 18.00, 49.00));
|
||||
al.add(4, new Inventory(303,"Lawn tractor", 5, 300.00, 650.00));
|
||||
return al;
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
String menu =
|
||||
"-------------------------------Inventory Menu-------------------------------\n"+
|
||||
"1) Check Item Inventory \n"+
|
||||
"2) Sell Item \n"+
|
||||
"3) Item Stock Report \n"+
|
||||
"4) Exit \n"+
|
||||
" Please enter your selection. Numbers 1-4 are accepted.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(menu);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 4)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
public static void doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
checkStock();
|
||||
break;
|
||||
case 2:
|
||||
sellItem();
|
||||
break;
|
||||
case 3:
|
||||
generateReport();
|
||||
break;
|
||||
case 4:
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static int getItemID() {
|
||||
String sPrompt = "Please enter the ID of the item you wish to query.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(sPrompt);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
iOut = -999;
|
||||
}
|
||||
else {
|
||||
iOut = getItemID();
|
||||
}
|
||||
}
|
||||
return iOut;
|
||||
|
||||
}
|
||||
public static int getStock(int iID) {
|
||||
for (int i=0;i<al.size();i++)
|
||||
{
|
||||
Inventory item = al.get(i);
|
||||
if(item.getiItemID() == iID) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
public static int checkStock(){
|
||||
int iID = getItemID();
|
||||
if (iID == -999) {
|
||||
return -999;
|
||||
}
|
||||
int iArrayID = getStock(iID);
|
||||
if(iArrayID == -999) {
|
||||
System.out.println("Item not found.");
|
||||
} else {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("Item ID - "+iID+" ("+sDesc+") Currently has "
|
||||
+iStock+" items in stock.");
|
||||
return iArrayID;
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
|
||||
private static void sellItem() {
|
||||
int iArrayID = checkStock();
|
||||
if (iArrayID != -999) {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateReport() {
|
||||
int iItemCount = 0;
|
||||
double dWorth = 0.00;
|
||||
System.out.println("Item ID\tItem Name\tStock\tMFG Price\tSale Price");
|
||||
for (int i=0;i<al.size();i++)
|
||||
{
|
||||
Inventory item = al.get(i);
|
||||
System.out.println(item.getiItemID()+"\t"+item.getsItemName()+"\t"+
|
||||
item.getiInStore()+"\t$"+item.getdManuPrice()+"\t\t$"+item.getdSellPrice());
|
||||
iItemCount += item.getiInStore();
|
||||
dWorth += (item.getiInStore()*item.getdManuPrice());
|
||||
}
|
||||
System.out.println("There are currently "+iItemCount+" items in store.");
|
||||
System.out.println("The total worh of the store is: $"+dWorth);
|
||||
}
|
||||
|
||||
private static void exit() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void doPurchase(int iArrayID) {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("The selling price is currently: $"+inv.getdSellPrice()+"\n"+
|
||||
"How many would you like to purchase?");
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = -999;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut <= 0)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid ammount, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut > inv.getiInStore())
|
||||
{
|
||||
System.out.println("We're sorry. We don't have that many in stock, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Input accepted. Your order for "+
|
||||
iOut+" "+sDesc+" will be placed. Confirm your order?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
System.out.println("Thank you! Your order has been recieved.\n"
|
||||
+ "You will be billed $"+(inv.getdSellPrice()*iOut));
|
||||
removeStock(iArrayID,iOut);
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("Your order has been canceled.");
|
||||
}
|
||||
|
||||
private static void removeStock(int iArrayID, int iOut) {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
iStock -= iOut;
|
||||
inv.setiInStore(iStock);
|
||||
al.set(iArrayID, inv);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user