首页 > 其他 > 详细

二元一次方程

时间:2016-10-10 01:14:23      阅读:202      评论:0      收藏:0      [点我收藏+]

package pers.weineel.quadratic;

import java.util.Random;

/**
* Created by weineeL on 2016/10/9.
*/
public class Quadratic {
private int a;
private int b;
private int c;
private Random rd = new Random();

public int getA() {
int temp = rd.nextInt(100);
a = temp == 0 ? temp + 1 : temp;
return a;
}

public int getB() {
b = rd.nextInt(100);
return b;
}

public int getC() {
c = rd.nextInt(100);
return c;
}

public String getQuadratic(){
int B = getB();
int C = getC();
return getA() + "x^2 + " + (B == 0 ? "" : B + "x + ") + (C == 0 ? "" : C) + " = 0";
}

public static void main(String [] argv){
Quadratic quadratic = new Quadratic();
System.out.println(quadratic.getQuadratic());
}
}

二元一次方程

原文:http://www.cnblogs.com/jy10/p/5944257.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!