急需:JAVA求和程序

来源:互联网 发布:change健身软件 编辑:程序博客网 时间:2024/05/01 12:31

   编写一个程序包含保存你的学费和书费的变量.显示变量的和.

 package com.cn.wll20110303.example7;

public class example7 {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  example8 ex8=new example8();
  System.out.println("学费与书费的和");
  System.out.println("总共是:"+ex8.add(3600,400)+"元");
 }

}

 

package com.cn.wll20110303.example7;

public class example8 {

 /**
  * @param args
  */
 public int add(int x,int y) {
  // TODO Auto-generated method stub
  return (x+y);
 }

}

求其它方法(用键盘输入学费和书费)

原创粉丝点击