2.package test;public class test { public static void main(String args[]){ int month=2; switch(month){ case 1: System.out.println("大月"); break; case 2: System.out.println("小月"); break; case 3: System.out.println("大月"); break; case 4: System.out.println("小月"); break; case 5: System.out.println("大月"); break; case 6: System.out.println("小月"); break; case 7: System.out.println("大月"); break; case 8: System.out.println("大月"); break; case 9: System.out.println("小月"); break; case 10: System.out.println("大月"); break; case 11: System.out.println("小月"); break; case 12: System.out.println("大月"); break; } }}3.package test;public class test { public static void main(String args[]){ int s=2; int w=2; if(s>300){ if(w<2&&w>=0){ System.out.println("98%收费"); }else if(w<6&&w>=2){ System.out.println("95%收费"); }else if(w>=6){ System.out.println("92%收费"); }else{ System.out.println("货重怎么能为负值?"); } }else if(s<300&&s>=0){ if(w<2&&w>=0){ System.out.println("100%收费"); }else if(w<6&&w>=2){ System.out.println("98%收费"); }else if(w>=6){ System.out.println("97%收费"); }else{ System.out.println("货重怎么能为负值?"); } }else{ System.out.println("运输距离怎么能为负值?"); } }}