Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

1. Based on the Person class in the Lecture Notes, define a subclass Teacher including one instance variable, office ( String type), and two methods, setOffice , and toString that returns the name,...

1 answer below »

1. Based on the Person class in the Lecture Notes, define a subclass Teacher including one instance variable, office (String type), and two methods, setOffice, and toString that returns the name, and office. Then write a driver that prompts the user to input a teacher's name and office information from the keyboard, and then output the teacher’ info to the monitor by invoking the toString method.

2. Based on the Time class and its derived class ExtTime class in the Lecture Notes, write a driver to test the polymorphism. That is, given the two objects of Time and ExtTime classes as below,

ExtTime x = new ExtTime();
Time y = new Time();
read the values of x and y from the keyboard, and then increase both objects by two seconds by invoking the increment() method twice (also inherited to the subclass). Then pass the two objects through the same display method so to output the info of objects to monitor. Use a loop, so the process could run continuously. Requirements: the time values should be read in the format of hh:mm:ss.

3. Based on the Line class in the Lecture Notes, read the four data (x0, y0, x1, y1) for a Line object from the keyboard, and output its length to the monitor by calling the corresponding method. Use a loop, so the process could be run continuously.

Answered 2 days After Aug 12, 2021

Solution

Shweta answered on Aug 14 2021
157 Votes
89522/Program1
uild/classes/.netbeans_automatic_build
89522/Program1
uild/classes/.netbeans_update_resources
89522/Program1
uild/classes/program1/Person.class
package program1;
public synchronized class Person {
private String name;
public void Person();
public void Person(String);
public void setName(String);
public String getName();
public String toString();
public boolean equals(Person);
}
89522/Program1
uild/classes/program1/Program1.class
package program1;
public synchronized class Program1 {
public void Program1();
public static void main(String[]);
}
89522/Program1
uild/classes/program1/Teacher.class
package program1;
public synchronized class Teacher extends Person {
private String office;
public void Teacher();
public void Teacher(String, String);
public void setOffice(String);
public String toString();
}
89522/Program1
uild.xml

Builds, tests, and runs the project Program1.


89522/Program1/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
89522/Program1/nbproject
uild-impl.xml















































































































































































































Must set src.di
Must set test.src.di
Must set build.di
Must set dist.di
Must set build.classes.di
Must set dist.javadoc.di
Must set build.test.classes.di
Must set build.test.results.di
Must set build.classes.excludes
Must set dist.ja




































































































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 -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




















































89522/Program1/nbproject/genfiles.properties
uild.xml.data.CRC32=92235e72
uild.xml.script.CRC32=17b5e2a
[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
uild-impl.xml.data.CRC32=92235e72
nbproject
uild-impl.xml.script.CRC32=07a88219
nbproject
[email protected]
89522/Program1/nbproject/private/private.properties
compile.on.save=true
user.properties.file=C:\\Users\\Acer\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
89522/Program1/nbproject/private/private.xml




file:/C:/Users/Ace
Documents/NetBeansProjects/Program1/src/program1/Person.java
file:/C:/Users/Ace
Documents/NetBeansProjects/Program1/src/program1/Program1.java
file:/C:/Users/Ace
Documents/NetBeansProjects/Program1/src/program1/Teacher.java


89522/Program1/nbproject/project.properties
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
uild.classes.dir=${build.dir}/classes
uild.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
uild.dir=build
uild.generated.dir=${build.dir}/generated
uild.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
uild.sysclasspath=ignore
uild.test.classes.dir=${build.dir}/test/classes
uild.test.results.dir=${build.dir}/test
esults
# Uncomment to specify the prefe
ed debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution ja
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Program1.ja
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.external.vm=true
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
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=program1.Program1
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
un.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.
# To set system properties for unit tests define test-sys-prop.name=value:
un.jvmargs=
un.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
89522/Program1/nbproject/project.xml

org.netbeans.modules.java.j2seproject


Program1







...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here