Section – A Answer any four of the following : 1 . Write a Program to calculate charges for sending particles when the charges are as follows For the first 1KG Rs.15.00 , For additional weight , for every 500gm or fraction thereof: Rs 8.00 Ans class Prog1 { static void test(double wt)//user enters the weight in KGs { System.out.println(“Parcel Weight is “+wt); int icharge = 15; System.out.println(“Initial charge is “+icharge); int rwt = (int)((wt-1)*1000); System.out.println(“Remaining weight after deducing 1Kg “+rwt); int rcharge = (rwt/500)*8; System.out.println(“Charge excluding fractional part is Rs.”+(icharge+rcharge)); int fcharge = (rwt%500>0)?8:0; System.out.println(“Charge for fractional part is Rs. “+fcharge); int tcharge = icharge+rcharge+fcharge; System.out.println(“Total Charge is Rs. “+tcharge); } } 2 . A special two-digit number is such that when the sum of its digits is added to the product of its digits , the res...
Comments
Post a Comment