Documents

Solution to specimen paper 2020.docx

Description
Description:
Categories
Published
of 10
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Transcript
  Solution to specimen paper 2020 Section-B 4. import java.util.*; import java.io.*; public class s_2019_4 { String name; int w; double charge,s_tax,tot_bill; public void accept() { Scanner sc=new Scanner(System.in); System.out.println( Enter your name ); name=sc.nextLine(); System.out.println( Enter your parcel weight ); w=sc.nextInt(); } public void calculate() { if (w<=10) charge=25*w; if(w>10&&w<=30) charge=25*w+20*(w-10); if(w>30) charge=25*w+20*(w-10)+10*(w-30);   s_tax=charge*.05; tot_bill=charge+s_tax; } public void print() { System.out.println( Name \t Weight of parcel t Bill amount ); System.out.println( =============================================== ); System.out.println(name + \t\t + w + \t\t +tot_bill); } public static void main(String ar[])throws IOException { s_2019_4 sp=new s_2019_4(); sp.accept(); sp.calculate(); sp.print(); } } 5. import java.util.*; import java.io.*; public class s_ { int i,j,min,n=3; String name[]=new String[n],tname; double per[]=new double[n],tper;   //int i,j,n; public void main() throws IOException { Scanner sc=new Scanner(System.in); System.out.print( Enter your name and percentage marks ); for( i=0;i<n;i++) { name[i]=sc.nextLine(); per[i]=Double.parseDouble(sc.nextLine()); } for(int i=0;i<n-1;i++) { min=i; for(int j=i+1;j<n;i++) { if(per[j]>per[min]) { min=j; } tper=per[i]; per[i]=per[min]; per[min]=tper; tname=name[i];   name[i]=name[min]; name[min]=tname; } System.out.print( the percentage marks in descending order are ); for(int k=n;k>0;k--) System.out.print(name[k]+ \t +per[k } } } 6. public class s_19_6 { int Sum(int A,int B) { int sum=0; for(int i=A;i<=B;i++) if(A%2==0) sum+=A; return sum; } double Sum(double N) {
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x