码迷,mamicode.com
首页 > 其他好文 > 详细

二元一次方程

时间:2016-10-10 01:16:06      阅读:124      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!