标签:
java里程表杂谈 |
分类: Java学习 |
一.程序说明:
主类类名:Drive
参数:
测试类名:DriveTest
测试数据:
driver1:
driver2:
测试结果:
Enter the distance for driver:123
Enter the oil for driver:12
driver1:
Pay attetion:Enter -1 for distance to quit!
二.程序源码:
1.主类源码:
public class Drive
{
private int distance;
private int oil;
private double peroil;
}
2.测试类名:
import java.util.Scanner;
public class DriveTest
{
public static void main(String args[])
{
Drive drive=new Drive();
Scanner input=new Scanner(System.in);
int depositDistance;
int depositOil;
int addDistance=0;
int addOil=0;
double average;
int i=1;
System.out.printf("Enter the distance for
driver:");
depositDistance=input.nextInt();
System.out.printf("Enter the oil for driver:");
depositOil=input.nextInt();
System.out.println();
while(depositDistance!=-1)
{
}
}
}