Oop Lab Work
Oop Lab Work
Submitted by:
Arslan Ahmed Khan
FA23-BCS-001
Submitted to
Umiar Mujtaba
Program 1:
package bookseller;
import java.util.Scanner;
/**
*
* @author fa23-bcs-001
*/
public class BookSeller {
public int a;
public int setter(){
System.out.println("Enter number of books purchased this month");
Scanner input=new Scanner(System.in);
a=input.nextInt();
return a;
}
public BookSeller(){
a=0;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
BookSeller b=new BookSeller();
int c=b.setter();
int points;
if(c==0){
points=0;
System.out.println("Points="+points);}
else if(c==1){
points=5;
System.out.println("Points="+points);}
else if(c==2){
points=15;
System.out.println("Points="+points);}
else if(c==3){
points=30;
System.out.println("Points="+points);}
else if(c>=4){
points=60;
System.out.println("Points="+points);}
}
Program 2
package maxndex;
import java.util.Scanner;
/**
*
* @author fa23-bcs-001
*/
public class Maxndex {
scanner.close();
}
}
Program 3
import java.util.Scanner;
Program 5
import java.util.Scanner;
System.out.println(a + " raised to the power of " + n + " is: " + result);
}
int sum = 0;
int highest = ratings[0];
int lowest = ratings[0];
System.out.println("Reversed array:");
for (int i = 0; i < size; i++) {
System.out.print(reversedArray[i] + " ");
}
}
}
Program 8:
import java.util.Scanner;
System.out.println("Row with maximum sum: Row " + (maxRowIndex + 1) + " with sum " +
maxRowSum);
System.out.println("Column with maximum sum: Column " + (maxColIndex + 1) + " with sum " +
maxColSum);
}
}
import java.util.Scanner;
System.out.println("Row with maximum sum: Row " + (maxRowIndex + 1) + " with sum " +
maxRowSum);
System.out.println("Column with maximum sum: Column " + (maxColIndex + 1) + " with sum " +
maxColSum);
}
}