求解java题 有追加 在线等 请尽量用简单的语法详细解答 我是初学者 谢谢

Design an algorithm that will continuously prompt an operator for customer number, customer name and total amount owing on the customer's credit card and print the customer number, name and minimum amount due for each customer;
The minimum amount due is calculated based on the total amount owing, as follows:
If the total amount owing is less than or equal to (<=) $5.00, then the minimum amount due = total amount owing. If the total amount owing is greater than (>) $5.00. then the minimum amount due = one quarter (1/4 or 25%) of the total amount owing, provided this resulting (minimum amount due) is not less than $5.00; If the resulting amount (1/4 of total amount owing) is less than (<) $5.00, then the minimum amount due is $5.00.
Your program should end when the operator enters a customer number = 0. At the end of the program print the total number of customers processed and the sum total of the amount owing by each customer.

呵呵,看英文真累,下面是具体的代码,有些长,但是功能齐全,参考一下:
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

/*
* Design an algorithm that will continuously(连续不断的) prompt an operator for customer number,
* customer name and total amount owing on the customer's credit card
* and print the customer number,name and minimum amount due(最低的到期金额) for each customer;
The minimum amount due is calculated based on(计算依据) the total amount owing, as follows:
If the total amount owing is less than or equal to (<=) $5.00,
then the minimum amount due = total amount owing.
If the total amount owing is greater than (>) $5.00.
then the minimum amount due = one quarter (1/4 or 25%) of the total amount owing,
provided this resulting (minimum amount due) is not less than $5.00;
If the resulting amount (1/4 of total amount owing) is less than (<) $5.00,
then the minimum amount due is $5.00.
Your program should end when the operator enters a customer number = 0.
At the end of the program print the total number of customers processed
and the sum total of the amount owing by each customer.
*/

/*
* 设计一种算法,它将不断地为客户及时操作员号码,由于客户名称及总量在客户的信用卡
* 和打印客户编号、姓名和最低金额的款项为每一位客户;   由于计算最低限额是由于基于总量,
* 如下:   如果总欠金额小于或等于(< = 5.00美元,然后最低金额的款项总额由于=。
* 如果总欠金额大于5.00美元(>)。
* 然后最低限额=一个季度由于(或25%)的总欠金额,这导致提供(最低金额的款项)是不少于5.00美元,
* 如果结果金额总数由于)低于5.00美元(<)的最低金额的款项,然后是$ 5.00。  
* 你的程序应该结束时操作者进入了一个客户编号= 0。最后的程序打印的总数。客户处理
*/

class Customer1{
private int number ;
private String name ;
private double amount ;
private double min_amount_due ;

public Customer1(){}
public Customer1(int no,String n,double a){
number = no ;
name = n ;
amount = a ;
}

//这个题的关键在这里
public double getMin_amount_due() {
if(amount<=5){
min_amount_due = amount ;
}else{
if(0.25*amount <= 5){
min_amount_due = 5 ;
}else{
min_amount_due = 0.25*amount ;
}
}

return min_amount_due;
}

public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String toString(){
return "|--编号:" + number + "\n"
+ "|--姓名:" + name + "\n"
+ "|--最低到期金额: " + getMin_amount_due() ;
}

}

public class TestCustomer {
private List<Customer1> list = new ArrayList<Customer1>() ;
private int count = 0 ;
private double totle = 0 ;

public void inputInfo(){
int number ;
String name ;
double amount ;
Scanner sc = new Scanner(System.in) ;
System.out.println("===============开始录入信息=================") ;
boolean flag = true ;
while(flag){
System.out.print("请输入用户的编号:") ;
number = sc.nextInt() ;
System.out.print("请输入用户的姓名:") ;
name = sc.next() ;
System.out.print("请输入用户的金额:") ;
amount = sc.nextDouble() ;
Customer1 c = new Customer1(number,name,amount) ;
list.add(c) ;
if(number==0){
flag = false ;
}
System.out.println();
}
}

public void printInfo(List<Customer1> list){
System.out.println("===============开始输出信息=================") ;
Iterator<Customer1> it = list.iterator() ;
while(it.hasNext()){
Customer1 c = it.next() ;
System.out.println(c);
System.out.println();
totle += c.getAmount() ;
count ++ ;
}
}

public static void main(String[] args) {
TestCustomer tc = new TestCustomer() ;
tc.inputInfo() ;
tc.printInfo(tc.list) ;
System.out.println("==============结束后的统计信息================") ;
System.out.println("总共有" + tc.count + "名用户,总金额为:$" + tc.totle + ".") ;
}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-11-04
package cn.qbq.questions;

import java.util.Scanner;

public class Algorithm {

public static void main(String[] args) {

int totalNumberOfCustomers = 0;
double sumTotalOfTheAmountOwing = 0;

while(true) {
System.out.println("Please input customer number:");
String customerNumber = (new Scanner(System.in)).nextLine();

if ("0".equals(customerNumber)) {
System.out.println("Total : ");
System.out.println("The total number of customers : " + totalNumberOfCustomers);
System.out.println("The sum total of the amount owing : " + sumTotalOfTheAmountOwing);
return;
} else {

System.out.println("Please input customer name:");
String customerName = (new Scanner(System.in)).nextLine();

System.out.println("Please input total amount:");
String totalAmountOwingInput = (new Scanner(System.in)).nextLine();

double totalAmountOwing = Double.valueOf(totalAmountOwingInput);
double minimumAmountDue = 0;
if (totalAmountOwing <= 5.00) {
minimumAmountDue = totalAmountOwing;
} else {
minimumAmountDue = totalAmountOwing / 4;
if (minimumAmountDue < 5) {
minimumAmountDue = 5;
}
}

System.out.println("customer number : " + customerNumber);
System.out.println("customer name : " + customerName);
System.out.println("minimum amount : " + minimumAmountDue);

totalNumberOfCustomers++;
sumTotalOfTheAmountOwing += minimumAmountDue;
}
}

}
}本回答被提问者采纳
第2个回答  2011-11-04
Aren't you a Chinese?追问

我是中国人,这道题目就是英文的。
因为我觉得我的翻译可能会引起歧义而导致解答方向偏差,所以直接用了英文原题。
谢谢关注,希望得到你的帮助。

追答

/**
* 设计一个算法连续不断地去计算顾客的数量、名字、顾客信用卡欠费的总额,并且打印出顾客数量、名字和为每一位客户提供的最低金额的款项。
* 最低金额款项根据总欠金额进行计算,如下:如果总欠金额 $5.00,最低金额 = 25% *
* 总欠金额,如果此最低金额 < $5.00,则最低金额 =
* $5.00。当输入的顾客号码是0时,程序结束。在程序结束时显示客户处理的总数和每一位顾客和总欠费金额。
*/

后面的回答我看了下,意思差不多,我就不写了