急需:JAVA求和程序

    技术2022-05-19  27

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

     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); }

    }

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


    最新回复(0)