HW JAVE
HW_6-1/build.xml
Builds, tests, and runs the project HW_6-1.
HW_6-1/manifest.mf
Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build
HW_6-1/nbproject/build-impl.xml
Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes No tests executed. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -cp "${run.classpath.with.dist.jar}" ${main.class} To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must select one file in the IDE or set debug.class Must set fix.includes This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set profile.class This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set run.class Must select some files in the IDE or set test.includes Must select one file in the IDE or set run.class Must select one file in the IDE or set applet.url Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select some files in the IDE or set test.class Must select some method in the IDE or set test.method Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set test.class Must select some method in the IDE or set test.method Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url
HW_6-1/nbproject/genfiles.properties
build.xml.data.CRC32=f89e461b build.xml.script.CRC32=c43df769 [email protected] # 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=f89e461b nbproject/build-impl.xml.script.CRC32=3ec6035e nbproject/[email protected]
HW_6-1/nbproject/project.properties
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}/HW_6-1.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.source=1.5 javac.target=1.5 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ ${libs.junit.classpath}:\ ${libs.junit_4.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= jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" main.class=HW6_1.readAndWriteFileInfo manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF 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
HW_6-1/nbproject/project.xml
org.netbeans.modules.java.j2seproject HW_6-1 1.6.5
HW_6-1/src/HW6_1/readAndWriteFileInfo.java
HW_6-1/src/HW6_1/readAndWriteFileInfo.java
package
HW6_1
;
import
java
.
util
.
Scanner
;
import
java
.
io
.
*
;
public
class
readAndWriteFileInfo
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
name
;
String
address
;
String
city
;
String
state
;
String
cityState
;
String
zip
;
int
age
;
int
commaPosition
;
//declare the file object and open the file "student_info.txt";
File
myFile
=
new
File
(
"student_info.txt"
);
if
(
!
myFile
.
exists
())
{
System
.
out
.
println
(
"Unable to open student_info.txt"
);
System
.
exit
(
0
);
}
//declare the Scanner object and connect it to the file object
Scanner
inputFile
=
new
Scanner
(
myFile
);
//read from the input file
//info for one person is input/output each iteration
while
(
inputFile
.
hasNext
())
{
name
=
inputFile
.
nextLine
();
address
=
inputFile
.
nextLine
();
cityState
=
inputFile
.
nextLine
();
zip
=
inputFile
.
nextLine
();
age
=
inputFile
.
nextInt
();
inputFile
.
nextLine
();
//discard newline
//separate city and state
commaPosition
=
cityState
.
indexOf
(
','
);
city
=
cityState
.
substring
(
0
,
commaPosition
);
state
=
cityState
.
substring
(
commaPosition
+
1
);
//output information to the output file
// make a call to writeInfo with all appropriate information.
}
//close the file
inputFile
.
close
();
}
/**
* writes each data item to the screen on one line, in columns
*
@param
name
*
@param
address
*
@param
cityStateZip
*
@param
age
*/
public
static
void
writeInfo
(
String
name
,
String
address
,
String
city
,
String
state
,
String
zip
,
int
age
)
{
}
}
HW_6-1/student_info.txt
Mary Madalinski 3434 Whiteford Road Ottawa Lake, Michigan 45267 12 Virginia Rodriguez 456 Main Street Dayton, Ohio 45404 8 Darla Busbee 3824 Corey Road Toledo, Ohio 43613 9 Gary King 343 Carriage Hill Drive Toledo, Ohio 43613 10