import javax.swing.JOptionPane;
public class TheDirection {
public static void main(String[] args){
double a,b,c,t,r1,r2;
String number;
int messageType=JOptionPane.INFORMATION_MESSAGE;
number=JOptionPane.showInputDialog(null,"输入a");
a=Double.parseDouble(number);
number=JOptionPane.showInputDialog(null,"输入b");
b=Double.parseDouble(number);
number=JOptionPane.showInputDialog(null,"输入c");
c=Double.parseDouble(number);
t = b*b-4*a*c;
if(t>0){
r1 = (-b+Math.pow(t,0.5))/(2*a);
r2 = (-b-Math.pow(t,0.5))/(2*a);
String message="The equation has two roots " + r1 + " and "+ r2;
JOptionPane.showMessageDialog(null,message,"result",messageType);
}
else if(t==0){
r1 = (-b+Math.pow(t,0.5))/(2*a);
String message="The equation has one roots " + r1;
JOptionPane.showMessageDialog(null,message,"result",messageType);
}
else{
String message="The equation has no real roots ";
JOptionPane.showMessageDialog(null,message,"result",messageType);
} }
}

Exercise03_01的更多相关文章

随机推荐

  1. SpringMVC——说说视图解析器

    学习SpringMVC——说说视图解析器   各位前排的,后排的,都不要走,咱趁热打铁,就这一股劲我们今天来说说spring mvc的视图解析器(不要抢,都有位子~~~) 相信大家在昨天那篇如何获取请 ...

  2. Spring学习--使用 utility scheme 定义集合及 p命名空间

    util schema 定义集合: 使用基本的集合标签定义集合时 , 不能将集合作为独立的 Bean 定义 , 导致其他 Bean 无法引用该集合 , 所以无法在不同 Bean 之间共享集合. 可以用 ...

  3. vue双向绑定原理

    要了解vue的双向绑定原理,首先得了解Object.defineProperty()方法,因为访问器属性是对象中的一种特殊属性,它不能直接在对象中设置,而必须通过 Object.definePrope ...

  4. loggin

    # 参考:https://www.cnblogs.com/DI-DIAO/p/8793136.html BASE_LOG_DIR = os.path.join(BASE_DIR, "log& ...

  5. LARGE_INTEGER类型

    最近在研究Windows驱动程序开发,遇到这样一个语句: devExt->PortBase  = (PUCHAR)(ULONG_PTR) portBasePA.QuadPart; 在源代码环境中 ...

  6. POJ3468(线段树区间增加,区间求和)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 81519   ...

  7. 输入子系统--event层分析【转】

    转自:http://blog.csdn.net/beyondioi/article/details/9186723 ########################################## ...

  8. 【bzoj2212&3702】二叉树

    线段树合并入门题. 分别计算左子树的逆序对,右子树的逆序对,合并的时候计算贡献. #include<bits/stdc++.h> #define N 8000005 using names ...

  9. intValue()的用法

    今天看到了Integer的这个方法,有点疑惑,查了下,做下笔记; 1.intValue()是java.lang.Number类的方法,Number是一个抽象类.Java中所有的数值类都继承它.也就是说 ...

  10. vCard

    vCard 在翻阅dottoro的时候,在附录(appendix)的js部分,注意到一个叫vCard的部分,能单独列出来,可能是比较重要的,至少是比较独立的部分,但是以前从未听说或者了解过这一部分,如 ...