太原理工大学软件java实验报告(12)
发布时间:2021-06-12
发布时间:2021-06-12
}
System.out.println("相减为:("+a+","+b+")");
public void Multiply(Complex x,Complex y){
}}
double a = x.a*y.a-x.b*y.b; double b= x.a*y.b+x.b*y.a;
System.out.println("相乘为:("+a+","+b+")");
(2) 创建银行账号Account类,实现存款(balance)的存(deposit)、取(withdraw)和查询(getbalance)等功能 。 import java.io.*;
public class Account {
public static void main(String[] args) throws IOException{ }
public Account(){ }
public void deposit()throws IOException{
System.out.println("请输入存款金额:"); BufferedReader br = new BufferedReader(new double s = Double.parseDouble(br.readLine());
System.out.println("存款成功 "+"余额为:"+(s+fund));
System.out.println("请选择服务:");
// TODO Auto-generated method stub Account a = new Account();
System.out.println("存款选择1 取款选择2 查询选择3"); BufferedReader br = new BufferedReader(new int n = Integer.parseInt(br.readLine()); if(n==1)
a.deposit(); a.withdraw(); a.getbalance();
System.out.println("输出不正确!"); else if(n==2) else if(n==3) else
double fund = 1000;
InputStreamReader(System.in));
InputStreamReader(System.in));
上一篇:宜春一对一辅导机构哪家好