



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Java lab exercises that include the codes for java classes ,construtor,operator overloading and basics
Typology: Assignments
1 / 7
This page cannot be seen from the preview
Don't miss anything!
do { System.out.println("Course:"); s1[i].lc[j]=sc.nextLine(); if((s1[i].lc[j].substring(0,3)).equals("CSE")!=true) System.out.println("Enter again"); }while((s1[i].lc[j].substring(0,3)).equals("CSE")!=true); do { System.out.println("Marks: "); s1[i].lm[j]=sc.nextInt(); if(s1[i].lm[j]<0 && s1[i].lm[j]>100) System.out.println("Enter again"); }while(s1[i].lm[j]<0 && s1[i].lm[j]>100); sc.nextLine(); } } int p1=0,p2=0,sum1=0,sum2=0,be=0; for(int i=0;i<n;++i) { if(s1[i].lm[0]>40) ++p1; sum1+=s1[i].lm[0]; if(s1[i].lm[1]>40) ++p2; sum2+=s1[i].lm[1]; if(s1[i].lm[1]<50 && s1[i].lm[0]<50) ++be; } double ps1=(double)p1/n100.0; double ca1=(double)sum1/(n); double ps2=(double)p2/n100.0; double ca2=(double)sum2/(n); int max1=0,m1=0,m2=0,max2=0; for(int i=0;i<n;++i) { if(s1[i].lm[0]>m1) { max1=s1[i].rno; m1=s1[i].lm[0]; } if(s1[i].lm[1]>m2) {
โ Display number of customers who got discounts and their phone numbers โ Which customer got highest purchase display phone number and amount.( there may be more than one bill for each customer) โ Calculate the overall discount percentage given for the customers. Code: import java.util. Scanner; class Bill{ static int id=52330; int no; String cnum; String items[]=new String[10]; int uprice[]=new int[10]; int quantity[]=new int[10]; int price[]=new int[10]; int total; Bill(String i[],int up[],int q[],String cn){ no=id++; items=i; uprice=up; cnum=cn; quantity=q; for(int j=0;j<items.length;j++){ price[j]=uprice[j]*quantity[j]; total+=price[j]; } } void discount(Bill b[],int n){ int max=0,index=0; for(int i=0;i<n;i++){ if(b[i].total>3000) System.out.println(b[i].no+" "+b[i].cnum); if(b[i].total>max){ max=b[i].total; index=i;