Class 类、接口或枚举应出现14个错误
我正在尝试做一个incometax程序,并不断得到14个这样的错误。 请帮忙Class 类、接口或枚举应出现14个错误,class,interface,enums,Class,Interface,Enums,我正在尝试做一个incometax程序,并不断得到14个这样的错误。 请帮忙 /* *Printing IncomeTax *9/7/15 */ import java.util.Scanner; public class IncomeTax { public static void main(String[] args); { Scanner keyboard = new Scanner(System.in); System.out.print
/*
*Printing IncomeTax
*9/7/15
*/
import java.util.Scanner;
public class IncomeTax
{
public static void main(String[] args);
{
Scanner keyboard = new Scanner(System.in);
System.out.print("---Income Tax Program---\n\n\n");
System.out.print("Your income:");
double income = keyboard.nextDouble();
System.out.print("Enter your filling status(S-Single,M-Married,J-JointlyFiling");
char filing=keyboard.next().charAt(0);
System.out.print("Enter the number of deductions you are claiming:");
int deductions = keyboard.nextInt();
double taxableIncome = taxableIncome(income,deductions);
double taxPercent = taxPercent(filingStatus,taxIncome);
double owedAmount = taxableIncome*taxPercent;
double takeHome= income-owedAmount;
double taxPercent2=taxPercent*100;
System.out.print("Income tax Information: ");
System.out.printf("\nIncome- %.2f",income);
System.out.print("Filing status:"+filing);
System.out.printf("Taxable Income- %.2f",taxabeIncome);
System.out.printf("Tax percentage:"+taxPercent1+"%");
System.out.printf("Tax owed: "+owedAmount);
System.out.printf("Take Home: "+takeHome);
}
}
public static double taxableIncome(double income,double deductions)
{
double taxIncome = income-5000-1000*deductions;
if (income>0)
return taxableIncome;
else
return 0;
}
public static double taxPercent(char filingStatus,double taxableIncome)
{
double taxPercent
if (taxIncome<=30000 && taxIncome>=0)
else if(filingStatus==S)
return==.05;
else if (filingStatus==M)
return==.08;
else ( filing status==J)
return==.10;
}
{
if (taxIncome<L=50000 && taxIncome>30000)
else if ( filingStatus == S)
return==.10;
else if(filingStatus == M)
return==.16;
else (filingStatus==J)
return==.20;
}
{
if (taxIncome>50000)
else if(filingStatus == S)
return==.20;
else if (filingStatus == M)
return ==.24;
else (filingStaus == J)
return==.30;
}
/*
*印染印染
*9/7/15
*/
导入java.util.Scanner;
公共类IncomeTax
{
公共静态void main(字符串[]args);
{
扫描仪键盘=新扫描仪(System.in);
System.out.print(“----所得税程序---\n\n\n”);
系统输出打印(“您的收入:”);
双倍收入=键盘.nextDouble();
系统输出打印(“输入您的填写状态(S-单身、M-已婚、J-联合填写”);
字符归档=键盘.next().charAt(0);
System.out.print(“输入您申请的扣减额:”);
整数扣减=keyboard.nextInt();
双重应纳税所得额=应纳税所得额(收入、扣除额);
double taxPercent=taxPercent(归档状态,taxIncome);
double Owdamount=应纳税所得额*应纳税百分比;
双倍带回家=收入欧德蒙特;
双taxPercent2=taxPercent*100;
系统输出打印(“所得税信息:”);
系统输出打印F(“\n收入-%.2f”,收入);
系统输出打印(“归档状态:+归档”);
System.out.printf(“应纳税所得额-%.2f”,税收收入);
System.out.printf(“税率:“+taxPercent1+”);
System.out.printf(“欠税:+owedAmount”);
System.out.printf(“takeHome:+takeHome”);
}
}
公共静态双重应纳税收入(双重收入,双重扣减)
{
双倍税收收入=收入-5000-1000*扣除额;
如果(收入>0)
返还应纳税所得额;
其他的
返回0;
}
公共静态双税百分比(字符存档状态,双税收入)
{
双倍税率
如果(taxIncome=0)
否则如果(文件状态==S)
回报率==.05;
否则如果(归档状态==M)
返回==.08;
其他(归档状态==J)
返回==.10;
}
{
如果(的士收入30000元)
否则如果(文件状态==S)
返回==.10;
否则如果(归档状态==M)
返回==.16;
其他(归档状态==J)
回报率==.20;
}
{
如果(taxIncome>50000)
否则如果(文件状态==S)
回报率==.20;
否则如果(归档状态==M)
返回==.24;
else(filingStaus==J)
回报率==0.30;
}
--------------------配置:-------------C:\Users\Tazeen\Downloads\IncomeTax.java:41:错误:类、接口、,
或枚举预期公共静态双重应纳税收入(双重
收入(双重扣减)
^C:\Users\Tazeen\Downloads\IncomeTax.java:44:错误:如果(收入>0),则应为类、接口或枚举^
C:\Users\Tazeen\Downloads\IncomeTax.java:46:error:class,interface,
或者需要其他枚举^
C:\Users\Tazeen\Downloads\IncomeTax.java:49:error:class,interface,
或应为枚举}^
C:\Users\Tazeen\Downloads\IncomeTax.java:50:error:class,interface,
或枚举应为公共静态双taxPercent(字符
申报状态,双重应纳税收入)
^C:\Users\Tazeen\Downloads\IncomeTax.java:57:错误:需要类、接口或枚举
否则如果(归档状态==M)
^C:\Users\Tazeen\Downloads\IncomeTax.java:59:错误:需要类、接口或枚举
其他(归档状态==J)
^C:\Users\Tazeen\Downloads\IncomeTax.java:61:错误:需要类、接口或枚举}^
C:\Users\Tazeen\Downloads\IncomeTax.java:67:error:class,interface,
或应为枚举
否则如果(归档状态==M)
^C:\Users\Tazeen\Downloads\IncomeTax.java:69:错误:需要类、接口或枚举
其他(归档状态==J)
^C:\Users\Tazeen\Downloads\IncomeTax.java:71:错误:需要类、接口或枚举
}
^C:\Users\Tazeen\Downloads\IncomeTax.java:77:错误:需要类、接口或枚举
否则如果(归档状态==M)
^C:\Users\Tazeen\Downloads\IncomeTax.java:79:错误:需要类、接口或枚举
else(filingStaus==J)
^C:\Users\Tazeen\Downloads\IncomeTax.java:81:错误:类、接口或枚举应为}^14个错误
进程已完成。该方法不在类中;请将其移动到第二个大括号内 对不起,这段代码乱七八糟。它全错了 你似乎不太在意自己在做什么。要么开始关注,要么今天就放弃编码
/*
*Printing IncomeTax
*9/7/15
* @link https://stackoverflow.com/questions/33070915/class-interface-or-enum-expected-14-errors/33070940#3307094010
*/
import java.util.Scanner;
public class IncomeTax {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Your income:");
double income = keyboard.nextDouble();
System.out.print("Enter your filling status(S-Single,M-Married,J-JointlyFiling");
char filingStatus = keyboard.next().charAt(0);
System.out.print("Enter the number of deductions you are claiming:");
int deductions = keyboard.nextInt();
double taxableIncome = getTaxableIncome(income, deductions);
double taxPercent = getTaxPercent(filingStatus, taxableIncome);
double owedAmount = taxableIncome * taxPercent;
double takeHome = income - owedAmount;
double taxPercent1 = taxPercent * 100;
System.out.println("Income tax Information: ");
System.out.println("Income: " + income);
System.out.println("Filing status: " + filingStatus);
System.out.println("Taxable Income: " + taxableIncome);
System.out.println("Tax percentage: " + taxPercent1);
System.out.println("Tax owed: " + owedAmount);
System.out.println("Take Home: " + takeHome);
}
public static double getTaxableIncome(double income, int numDeductions) {
double taxableIncome = income - 5000 - 1000 * numDeductions;
return (taxableIncome > 0.0 ? taxableIncome : 0.0);
}
public static double getTaxPercent(char filingStatus, double taxableIncome) {
double taxPercent = 0.0;
if (taxableIncome >= 0 && taxableIncome <= 30000) {
if (filingStatus == 'S') {
taxPercent = .05;
} else if (filingStatus == 'M') {
taxPercent = .08;
} else if (filingStatus == 'J') {
taxPercent = .10;
} else {
throw new IllegalArgumentException("Unknown tax percent");
}
} else if (taxableIncome > 30000 && taxableIncome <= 50000) {
if (filingStatus == 'S') {
taxPercent = .10;
} else if (filingStatus == 'M') {
taxPercent = .16;
} else if (filingStatus == 'J') {
taxPercent = .20;
}
} else if (taxableIncome > 50000) {
if (filingStatus == 'S') {
taxPercent = .20;
} else if (filingStatus == 'M') {
taxPercent = .24;
} else if (filingStatus == 'J') {
taxPercent = .30;
}
}
return taxPercent;
}
}
/*
*印染印染
*9/7/15
*@linkhttps://stackoverflow.com/questions/33070915/class-interface-or-enum-expected-14-errors/33070940#3307094010
*/
导入java.util.Scanner;
公共类IncomeTax{
公共静态void main(字符串[]args){
扫描仪键盘=新扫描仪(System.in);
系统输出打印(“您的收入:”);
双倍收入=键盘.nextDouble();
系统输出打印(“输入您的填写状态(S-单身、M-已婚、J-联合填写”);
char filingStatus=keyboard.next().charAt(0);
System.out.print(“输入您申请的扣减额:”);
整数扣减=keyboard.nextInt();
双重应纳税所得额=应纳税所得额(收入、扣除额);
double taxPercent=getTaxPercent(申报状态,应纳税收入);
double Owdamount=应纳税所得额*应纳税百分比;
双倍带回家=收入-欧维达蒙特;
双taxPercent1=taxPercent*100;
System.out.println(“所得税信息:”);
系统输出打印项次(“收入:+收入);
System.out.println(“归档状态:+归档状态”);
System.out.println(“应纳税所得额:+应纳税所得额”);
System.out.println(“税率:“+taxPercent1”);
System.out.println(“欠税:+owedAmount”);
System.out.println(“带回家:+takeHome”);
}
公共静态双倍可征税收入(双倍收入,整数教育){