java处理银行借贷问题.docx_第1页
java处理银行借贷问题.docx_第2页
java处理银行借贷问题.docx_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

/题目:银行互相借钱,如果一个银行倒闭,它借的钱就不能返还给借贷方,并且借贷方也不能将这个贷款算入他的总资产。In.txt的内容是25 2 1 100.5 4 320.5125 2 2 40 3 85175 2 0 125 3 7575 1 0 125181 1 2 125这个程序是一个Java题目:独立完成的,老费劲了 in.txt 的一排数据分别是no1.是银行现有资产 no2.是借款银行总数 no3与no4 是一组,代表了贷款银行id和贷款的钱数 以后的都是一组/第一次用ddms真舒服,功能特别强大package com.mingrui.soft_struct;import java.io.*;public class BankBorrowProblem/*计算银行借贷问题,同时对银行进行评估*/public static void main(String args)try operFunc(); catch (IOException e) / TODO Auto-generated catch blocke.printStackTrace();/操作方法public static void operFunc() throws IOExceptionoutput(getBankInfo();/获得最后的银行金额,和等级public static double getBankInfo() throws IOExceptiondouble realNum=operInput();double totals=new doublerealNum.length;double bankIsRight=new doublerealNum.length;double total=0;int count=1;boolean flag=false;for(int i=0;ibankIsRight.length;i+)bankIsRighti=1;for(int i=0;itotals.length;i+)totalsi=0;for(int i=0;irealNum.length;i+)total+=realNumi0;for(int j=0;jrealNumi1;j+)total+=realNumi1+2*count;count+;count=1;if(int)total=201)bankIsRighti=0;total=0;for(int i=0;irealNum.length;i+)totalsi+=realNumi0;for(int j=0;jrealNumi1;j+)for(int k=0;kbankIsRight.length;k+)int tmp1=(int)bankIsRightk;int tmp2=(int)realNumi2*count;if(tmp1=0&tmp2=k)flag=true;/else /flag=false;if(flag=true)totalsi+=0;elsetotalsi+=realNumi1+2*count;count+;flag=false;count=1;return totals;/对输入进行操作public static double operInput() throws IOExceptionString nums=readInput();String numParse=new Stringnums.length6;double realNum=new doublenums.length6;for(int i=0;inums.length;i+)numParsei=numsi.split( );for(int i=0;inums.length;i+)for(int j=0;jnumParsei.length;j+)realNumij=Double.parseDouble(numParseij);return realNum;/读取输入public static String readInput() throws IOExceptionFile f = new File(in.txt);FileReader fr = new FileReader(f);BufferedReader br = new BufferedReader(fr);/FileInputStream fis = new FileInputStream(f);String line=;String nums=new String5;int i=0;while(line=br.readLine()!=null)numsi+=line;return nums;/输出方法public static void output(double totals)String bankInfo=不符合的银行是;for(int i=0;itotals.length;i+)if(totalsi201)bankInfo+=i

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论