Buscar

Classe Java para Calculo da Formula de Bhaskara

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

Bhaskara/build.xml
 
 Builds, tests, and runs the project Bhaskara.
 
 
Bhaskara/build/built-jar.properties
#Thu, 31 Mar 2016 10:16:02 -0300
/home/joao/NetBeansProjects/Bhaskara=
Bhaskara/build/classes/.netbeans_automatic_build
Bhaskara/build/classes/.netbeans_update_resources
Bhaskara/build/classes/bhaskara/Bhaskara.class
Bhaskara/build/classes/bhaskara/Coeficientes.class
Bhaskara/dist/Bhaskara.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.4
Created-By: 1.8.0_74-b02 (Oracle Corporation)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: bhaskara.Bhaskara
bhaskara/Bhaskara.class
bhaskara/Coeficientes.class
Bhaskara/dist/README.TXT
========================
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 "Bhaskara.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.
Bhaskara/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Bhaskara/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 -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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Bhaskara/nbproject/genfiles.properties
build.xml.data.CRC32=e321b462
build.xml.script.CRC32=a3af587e
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# 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=e321b462
nbproject/build-impl.xml.script.CRC32=f56a6cad
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
Bhaskara/nbproject/private/private.properties
compile.on.save=true
user.properties.file=/home/joao/.netbeans/8.0.2/build.properties
Bhaskara/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
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}
# Os arquivos em build.classes.dir que devem ser exclu\u00eddos do jar de distribui\u00e7\u00e3o
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Bhaskara.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.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=bhaskara.Bhaskara
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.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
 ${javac.test.classpath}:\
 ${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
Bhaskara/nbproject/project.xml
 
 org.netbeans.modules.java.j2seproject
 
 
 Bhaskara
 
 
 
 
 
 
 
 
Bhaskara/src/bhaskara/Bhaskara.java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bhaskara;
/**
 *
 * @author joao
 */
public class Bhaskara {
 /**
 * @param args the command line arguments
 */
 public static void main(String[] args) {
 // TODO code application logic here
 
 // Cria um novo objeto coeficientes e seus parâmetros a,b,c
 Coeficientes coeficientes = new Coeficientes(1,8,16);
 
 System.out.println("Delta:["+coeficientes.getDelta()+"]");
 System.out.println("X:["+coeficientes.getX()+"]");
 System.out.println("Xi:["+coeficientes.getXi()+"]");
 coeficientes = new Coeficientes(1,-2,-3);
 System.out.println("-----------------------------------");
 System.out.println("Delta:["+coeficientes.getDelta()+"]");
 System.out.println("X:["+coeficientes.getX()+"]");
 System.out.println("Xi:["+coeficientes.getXi()+"]");
 
 }
 
}
Bhaskara/src/bhaskara/Coeficientes.java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bhaskara;
/**
 *
 * @author joao andré martins
 * Classe que recebe os coeficientes da equação de segundo grau e calcula
 * Delta e suas raizes
 */
public class Coeficientes {
 private double a;
 private double b;
 private double c;
 private double x;
 private double xi;
 private double delta;
 
 
 public Coeficientes(double a, double b, double c) {
 this.a = a;
 this.b = b;
 this.c = c;
 this.delta=(Math.pow(b, 2)-4*a*c);
 this.x=(-b+Math.sqrt(delta))/(2*a);
 this.xi=(-b-Math.sqrt(delta))/(2*a);
 }
 public double getA() {
 return a;
 }
 
 public double getB() {
 return b;
 }
 
 public double getC() {
 return c;
 }
 
 public double getX() {
 return this.x;
 }
 
 public double getXi() {
 return this.xi;
 }
 
 public double getDelta() {
 return this.delta;
 }
 
 
}

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Outros materiais