Michelle W. Talani Bsinte I-A
Michelle W. Talani Bsinte I-A
System.out.println("invalid input"); System.exit(0); } if((kwh>=0)&&(kwh<=1000)){ System.out.println("Commercial electric bill:"+format1); } else System.out.println("invalid input"); } else if((code.equals("I"))||(code.equals("i"))){ try{ System.out.println("industrial"); System.out.println("press 1 for peak hours, 2 for off peak hours"); System.out.println("enter the code"); code2=Integer.parseInt(dataIn.readLine()); System.out.println("enter kwh used"); kwh=Double.parseDouble(dataIn.readLine()); }catch(Exception e){ System.out.println("invalid input"); System.exit(0); } if(code2==1){ System.out.println("peak hours"); if((kwh>0)&&(kwh<=1000)){ System.out.println("Industrial electric bill: 76.00"); } else if(kwh>1000){ bill=76.00+((kwh-1000)*0.0652); format2.format("%2f",bill); System.out.println("Industrial electric bill:" + format2); } else System.out.println("invalid input"); } else if(code2==2){ System.out.println("Off-peak hours"); if((kwh>=0)&&(kwh<=1000)){ System.out.println("Industrial electric bill:" + format3); } else System.out.println("invalid input"); } } } } }
public static void main(String[] args) { // TODO code application logic here double gross=0; double sstax=0; double fitax=0; double sitax=0; double weeklypays=0; double dependents=0; double hour=0; try{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter the gross"); gross=Integer.parseInt(br.readLine()); System.out.println("enter the sstax"); sstax=Integer.parseInt(br.readLine()); System.out.println("enter the fitax"); fitax=Integer.parseInt(br.readLine()); System.out.println("enter the sitax"); sitax=Integer.parseInt(br.readLine()); System.out.println("enter the weeklypays"); weeklypays=Integer.parseInt(br.readLine()); System.out.println("enter the dependents"); dependents=Integer.parseInt(br.readLine()); System.out.println("enter the hour"); hour=Integer.parseInt(br.readLine()); } catch(NumberFormatException ne) { System.out.println("invalid value" + ne); System.exit(0); } catch(IOException ioe) { System.out.println("IO Error" + ioe); System.exit(0); } if (hour>40){ gross=((40*16.78)+(hour+40)*(16.78*1.5)); } else { gross=hour*16.78; { sstax=gross*.06; fitax=gross*14;
sitax=gross*.05; } if(dependents>3){ weeklypays=gross-(sstax+fitax+sitax)-35-10; } weeklypays=gross-(sstax+fitax+sitax)-10; } System.out.println("the worker grosspay is:" +gross); System.out.println("the worker sstaxpay is:" +sstax); System.out.println("the worker fitaxpay is:" +fitax); System.out.println("the worker sitaxpay is:" +sitax); System.out.println("the worker weeklypays is:" +weeklypays); System.out.println("the worker dependentspay is:" +dependents); System.out.println("the worker hourpay is:" +hour); } } public static void main(String[] args) throws IOException { // TODO code application logic here int MaxRoomCapacity=50; int NumOfPeopleNeeded=0; int NumOfPeopleEx=0; int NumOfPeopleAttended=0; try{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter the MaxRoomCapacity"); MaxRoomCapacity=Integer.parseInt(br.readLine()); System.out.println("enter the NumOfPeopleNeeded"); NumOfPeopleNeeded =Integer.parseInt(br.readLine()); System.out.println("enter the NumOfPeopleEx"); NumOfPeopleEx =Integer.parseInt(br.readLine()); System.out.println("enter the NumOfPeopleAttended"); NumOfPeopleAttended =Integer.parseInt(br.readLine()); } catch(NumberFormatException ne) { System.out.println("invalid value"+ne); System.exit(0); } catch(IOException ioe) { System.out.println("IO Error" + ioe); System.exit(0); } if (NumOfPeopleAttended>=MaxRoomCapacity) {
NumOfPeopleEx=NumOfPeopleAttended-MaxRoomCapacity; System.out.println(" "); System.out.println("The maximum room capacity is: " + MaxRoomCapacity); System.out.print(""); System.out.print("NumOfPeopleAttended"); System.out.println("people will be attending."); System.out.println(" "); System.out.println("ANNOUNCEMENT!!!"); System.out.println("The meeting cannot be held as planned due to fire regulations."); System.out.print(""); System.out.println(NumOfPeopleEx + " people must be excluded in order to meet the maximum room capacity"); } else { NumOfPeopleNeeded=MaxRoomCapacity-NumOfPeopleAttended; System.out.println(" "); System.out.println("The maximum room capacity is: " + MaxRoomCapacity); System.out.print(""); System.out.print(" NumOfPeopleAttended"); System.out.println("people will be attending"); System.out.println(" "); System.out.println("ANNOUNCEMENT!!!"); System.out.println("It is legal to hold the meeting"); System.out.print(""); System.out.println(NumOfPeopleNeeded+" people may legally attend "); } } } INCOMETAX public static void main(String[] args)throws IOException { // TODO code application logic here double tax=0; int s=0; double taxin=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try{ do{ System.out.println("enter tax"); tax=Integer.parseInt(br.readLine()); if(tax<=30000){ System.out.println("please re enter correct value..!");
} }while(tax<=30000); System.out.println("********************************************"); System.out.println("* FILLING STATUS *"); System.out.println("* Single ----1*"); System.out.println("* Married filling joinly ----2*"); System.out.println("* Married filling separete ----3*"); System.out.println("* Head of the house ----4"); System.out.println("********************************************"); System.out.println(""); do{ System.out.println("enter code"); s=Integer.parseInt(br.readLine()); if(s<1||s>4); { System.out.println("please re enter correct value..!"); } }while(s<1||s>4); } catch(NumberFormatException ne) { System.out.println("Invalid"); System.exit(0); } switch(s){ case 1: if(tax>49300){ taxin=5100.00+.31*tax; break; } case 2: if(tax>34000&&tax<82150){ taxin=5100.00+.28*tax; break; } else{ taxin=18582.00+.31*tax;break; } case 3: if(tax>41025){ taxin=9291.00+.31*tax; break; } case 4: if(tax>27300&&tax<70450){ taxin=4095.00+.28*tax;
break; } else{ taxin=16177.00+.31*tax;break; } default:{ System.out.println("Invalid Code!");break; } } System.out.println("Taxable Income:"+taxin); System.out.println("Filling Status:"+s); System.out.println("TAX:"+tax); } } MONEY CHANGER public static void main(String[] args)throws IOException { // TODO code application logic here
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("note:penny is 1 cent value and nickel is 5 cent value\n"); System.out.print("Enter quantity of pennies:"); int P=Integer.parseInt(br.readLine()); System.out.print("Enter quantity of nickels:"); int N=Integer.parseInt(br.readLine()); int d,c; int pq,nq,tq; pq=1*P; nq=5*N; tq=pq+nq; d=tq/100; c=(tq)-(d*100); System.out.println(d+"dollars/s"); System.out.println(c+"cent/s");
} }