📄 face.java
字号:
package face;
import java.io.*;
import calculator.*;
import exception.ManageException;
/**
* 这个类是面向用户的接口,用户所看到的正常操作的结果都有这个类实现
* @author ZiHi
* @param int income 输入的收入
* @param int cho,choo 用户的选择
*/
public class Face {
/**
* 这里是程序的主函数,也是用户执行代码的入口,为用户提供用于计算个人所得税的菜单和相应的操作指示
* @param args
* @throws IOException 主要的异常有用户输入类型的错误异常和文件打开异常以及其他IO异常
*/
public static void main(String args[]) throws IOException
{
int income;
int cho=1;
int choo;
BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
TaxTable taxtable;
taxtable=new TaxTable();
System.out.println( "Welcom to Personal Tax Calculator");
taxtable.Show();
do{
System.out.println( "Please choose your opreate");
System.out.println( "1.Input your income");
System.out.println( "2.Change the tax table");
System.out.println( "3.Quit");
try{
cho=Integer.parseInt(keyboard.readLine());
if(cho==1){
System.out.print( "Please input your input: ");
income = Integer.parseInt(keyboard.readLine());
Calculator calculator=new Calculator(income,taxtable);
calculator.Maketax();
System.out.println( "The tax you needed to take is: "+calculator.GetTax());
}
else if(cho==2)
{
System.out.println( "Please choose the opreate you wnat to do");
System.out.println( "1.Add rank");
System.out.println( "2.Delete rank");
System.out.println( "3.Set rank");
System.out.println( "Any other number for Back");
String a=keyboard.readLine();
try{
choo=Integer.parseInt(a);
if(choo==3)
{
taxtable.Show();
System.out.println( "Please input the rank you wnat to change");
int cho1; int cho2; double cho3;
cho1=Integer.parseInt(keyboard.readLine());
System.out.println( "Please input the base you wnat to change");
cho2=Integer.parseInt(keyboard.readLine());
System.out.println( "Please input the rate you wnat to change");
cho3=Double.parseDouble(keyboard.readLine());
taxtable.SetRank(cho1, cho2, cho3);
taxtable.Show();
}
else if(choo==1)
{
taxtable.Show();
System.out.println( "Please input the level you want to add");
int in1;
in1=Integer.parseInt(keyboard.readLine());
System.out.println( "Please input the rate you want to add");
double in2;
in2=Double.parseDouble(keyboard.readLine());
taxtable.AddRank(in1, in2);
taxtable.Show();
}
else if(choo==2)
{
taxtable.Show();
System.out.println( "Please input the rank you want to del");
int in1;
in1=Integer.parseInt(keyboard.readLine());
taxtable.DeletRank(in1);
taxtable.Show();
}
else if(cho!=4){System.out.println("Go back");}
}
catch(IOException e){
new ManageException(e);
}
catch(NumberFormatException e){
new ManageException(e);
}
}
else if(cho!=3){System.out.println("Please input the right choice!");}
}
catch(IOException e){
new ManageException(e);
}
catch(NumberFormatException e){
new ManageException(e);
}
if(cho==3){
System.out.println("Do you want to save the taxtable?");
System.out.println("1.Yes");
System.out.println("2.No");
int inp=Integer.parseInt(keyboard.readLine());
if(inp==1)taxtable.Save();
else if(inp!=2){System.out.println("Please input the right choice!");}
}
}while(cho!=3);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -