Java 请教

来源:百度知道 编辑:UC知道 时间:2024/06/04 06:25:29
if(change=='y')
System.out.println("Change employee's over time (max 48hrs): ");
overTime=input.nextInt();
if(overTime>48)
{
System.out.print("Over time CANNOT exceed 48 hours,re-enter...\nChange employee's over time (max 48hrs): ");
overTime=input.nextInt();
}

System.out.println("Employee's transport claim: $200.0"
System.out.print("Do you want to change? <y/n>");
change=(char)System.in.read();
if(change=='y')
{
System.out.print("Change employee's transport claim (max $300): ");
claim=input.nextInt();
if(claim>300
{
System.out.print("Transport claim CANNOT exceed $300,re-enter...\nChange employee's transport claim (max $300): ");

import java.io.IOException;
import java.util.Random;

public class Test {
public static void main(String[] args) {
try {
char change = 0;
int overTime, claim;
Random input = new Random();
//与输入的值进行判断,这里y表示确定选择,如果改为n的话就相当于不确定,所以步骤就相反而行了。
char choice = 'y';
if (change == choice)
System.out.println("Change employee's over time (max 48hrs): ");
overTime = input.nextInt();
if (overTime > 48) {
System.out
.print("Over time CANNOT exceed 48 hours,re-enter...\nChange employee's over time (max 48hrs): ");
overTime = input.nextInt();
}

System.out.println("Employee's transport claim: $200.0");
System.out.print("Do you want to change? <y/n>");
change = (char) System.in.read();

if (change == choice) {
System.out
.print("