Java计算利润代码 计算员工工资java

java编程:假设在银行存款10000元,按6.25%的年利润计算,多少年能连本带利翻一番?

package cn.javass.spring3.hello.java;

我们提供的服务有:网站制作、成都网站建设、微信公众号开发、网站优化、网站认证、云溪ssl等。为上千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的云溪网站制作公司

public class Test2 {

public static void main(String[] args) {

int bank = 10000;

int count = 0;

while (bank = 20000) {

bank += bank * 6.25 * 0.01;

count++;

}

System.out.println(count);

}

}

结果12年

通过java程序计算收益最大值

我试试吧 你留个QQ啥的  做完了好给你啊

看了一会题 感觉答案就是x1=0,x2=0,x3=110000

x3的价格跟成功率都是最多了 所以只卖x3就行了

还用算吗

public class ForMax {

/**

 * @param args

 */

public static void main(String[] args) {

// TODO Auto-generated method stub

//为了简化程序,也为了避免计算出来的数量中包含小数,所以数量这里除以1000,成功率都乘以1000

int x1=0,x2=0,x3=0;

double a1=6;

double a2=7;

double a3=3;

int b1=10,b2=20,b3=30;

double money=0;

double max=0;

for (int i = 0; i = 110; i++) {

for (int j = 0; j = 110; j++) {

for (int k = 0; k = 110; k++) {

if (i+j+k==110) {

if (i*a1+j*a2+k*a3=500) {

money=i*a1*b1+j*a2*b2+k*a3*b3;

if (moneymax) {

max=money;

x1=i*1000;

x2=j*1000;

x3=k*1000;

}

}

}

}

}

}

System.out.println("最高收益为:"+max);

System.out.println("x1:"+x1);

System.out.println("x2:"+x2);

System.out.println("x3:"+x3);

}

}

代码给你了 你自己设计成功率吧,0.3的结果是只卖x2

如何用Java写一个计算净收入的方法?

老板,有用的话别忘采纳和点赞哟,给我个小小支持。

先上代码:

public static void main(String[] args) {

int result = 0;

Scanner scanner = new Scanner(System.in);

System.out.println("请输入要统计的字符窜:");

String str = scanner.nextLine();

System.out.println("input:"+str);

String arrays[] = str.split(" ");

for (int i = 0; i arrays.length; i++) {

if (!arrays[i].contains("-")) {

result += getNumbers(arrays[i]);

}else {

result -= getNumbers(arrays[i]);

}

}

System.out.println("output:"+result);

}

//截取数字

public static int getNumbers(String content) {

Pattern pattern = Pattern.compile("\\d+");

Matcher matcher = pattern.matcher(content);

while (matcher.find()) {

return Integer.parseInt(matcher.group(0));

}

return 0;

}

运行效果:

java题,求下题代码。

public class Product {

private String productName;

private double costPrice;

private double price;

private java.util.Date outDate;

private String batch;

public String getProductName() {

return productName;

}

public void setProductName(String productName) {

this.productName = productName;

}

public double getCostPrice() {

return costPrice;

}

public void setCostPrice(double costPrice) {

this.costPrice = costPrice;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

public java.util.Date getOutDate() {

return outDate;

}

public void setOutDate(java.util.Date outDate) {

this.outDate = outDate;

}

public String getBatch() {

return batch;

}

public void setBatch(String batch) {

this.batch = batch;

}

/**

 * 判断产品是否过期

 * @param product

 * @return 是否过期

 * @returnType boolean

 */

public boolean isOutDate(Product product){

return new java.util.Date().getTime()  product.getOutDate().getTime();

}

/**

 * 计算毛利润

 * @param product

 * @return 毛利润

 * @returnType double

 */

public double getGrossProfit(Product product){

return product.getPrice() - product.getCostPrice();

}

/**

 * 修改产品价格

 * @param product

 * @param price

 */

public void updateProductPrice(Product product, double price){

product.setPrice(price);

}

/**

 * 打折出售

 * @param product

 * @param price

 */

public void discount(Product product, double discount){

product.setPrice(product.getPrice() * discount);

}

}

java计算简单的数学公式.

public class Demo2 {

public static void main(String[] args) {

double price = 100.0 ;//单价

int nums = 200;//数量

double total;//总价

total =   price*nums;// 计算总价

double profit ;//利润

double cost=12000;//成本

double tax=0.17;//税率

profit = (total-cost)*(1-tax); //计算利润

System.out.println("利润:"+profit+"元");//输出利润

}

}

运行测试

利润:6640.0元


当前标题:Java计算利润代码 计算员工工资java
转载注明:http://ybzwz.com/article/highse.html