Java使用Eclipse初学者

Java使用Eclipse初学者

本文介绍了Java使用Eclipse初学者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一系列交易将在个人银行账户上进行。每笔交易都包含一种交易类型,L表示提交或W表示取款和金额。


例如L 55.00住宿55.00

W 30.00提款30.00

目前还不知道有多少交易但是交易是以交易类型终止的?X?。


(i)设计并编写一个程序来接受一个人的账号,余额和一系列交易。


您的程序的最终输出应类似于以下内容:



帐号:6578390


旧余额:103.00


新余额:234.00

A series of transactions is to be made on a persons bank account. Each transaction will consist of a transaction type, either L for lodgements or W for withdrawals and an amount.

e.g. L 55.00 Lodging 55.00
W 30.00 Withdrawal 30.00

It is not known how many transactions there are but the transactions are terminated by transaction type ?X?.

(i)Design and write a program to accept a person?s account number, their balance and a series of transactions.

The final output from your program should be similar to the following:


Account Number : 6578390

Old balance : 103.00

New balance: 234.00

推荐答案





如果你认为我不知道java这是我做的第一个例子。


public class excercise {


/ **

* @param args

* /

public static void main( String [] args){

// TODO自动生成的方法存根

int postivetotal = 0;

int negativetotal = 0;

int number;

final int TERMINATOR = 0;


System.out.print("输入数字) ;);

System.out.flush();

number = uuInOut.ReadInt();


while(number != TERMINATOR){


if(number> 0)

postivetotal =(postivetotal + number);

else

negativetotal =(negativetotal + number);


System.out.print("输入数字);

系统.out.flush();

number = uuInOut.ReadInt();

}


}

If you think im don''t know java this was the first example i done.

public class excercise {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

int postivetotal = 0;
int negativetotal = 0;
int number;
final int TERMINATOR = 0;

System.out.print ("Enter a number");
System.out.flush();
number = uuInOut.ReadInt();

while (number != TERMINATOR){

if(number > 0)
postivetotal = (postivetotal + number);
else
negativetotal = (negativetotal + number);

System.out.print ("Enter a number");
System.out.flush();
number = uuInOut.ReadInt();
}

}


这篇关于Java使用Eclipse初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 06:42