0% found this document useful (0 votes)
5 views

Programming Notes

The document discusses a computer science assignment submitted by a student named M. Raffay from COMSATS University Islamabad, Attock Campus. The assignment involves calculating book prices, discounts on books, and total prices after discounts.

Uploaded by

Awais Muhammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Programming Notes

The document discusses a computer science assignment submitted by a student named M. Raffay from COMSATS University Islamabad, Attock Campus. The assignment involves calculating book prices, discounts on books, and total prices after discounts.

Uploaded by

Awais Muhammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

COMSATS University Islamabad

Attock Campus

Department Of Computer Science

Instructor Umer zia


theory 04
Assignment

Submitted by:
Registration No. Name
FA23-BCS-023 M.Raffay
static double[] discount = new double[3];

static double[] book = new double[3];

double[] discounted = new double[3];

double[] tot_salary = new double[3];

static Scanner scan = new Scanner(System.in);

public static double[] BOOK() {

for (int i = 0; i < 3; i++) {

System.out.println("Enter the salary of books: " + (i + 1));

book[i] = scan.nextDouble();

return book;

public static double[] DISCOUNT(double[] Book) {

for (int i = 0; i < 3; i++) {

if (Book[i] <= 100) {

discount[i] = Book[i] * 0.05;

} else if (Book[i] >= 100 && Book[i] <= 250) {

discount[i] = Book[i] * 0.1;

} else if (Book[i] >= 250 && Book[i] <= 500) {

discount[i] = Book[i] * 0.15;

} else if (Book[i] >= 500) {

discount[i] = Book[i] * 0.2;

} else {

discount[i] = 0;
}

return discount;

public static double[] TotalSalary(double[] salary, double[] tax,double[] tot_salary ) {

for (int i = 0; i < salary.length; i++) {

tot_salary[i] = salary[i] - tax[i];

return tot_salary;

public static double[] FInal(double[] discount, double[] Book,double[] discounted) {

for (int i = 0; i < Book.length; i++) {

discounted[i] = Book[i] - discount[i];

return discounted;

double[] books = BOOK();

double[] discount = DISCOUNT(books);

double[] Final = FInal(discount, books);

System.out.println (

"Name \t Quantity \t Price \t Total Price \t Discount \t Final Price");

for (int i = 0;

i< number ;
i

++) {

System.out.println(name[i] + " \t" + quantity[i] + "\t\t" + price[i] + "\t\t" + books[i] + "\t\t" + discount[i]

+ "\t\t" + Final[i]);

}Output:

You might also like