Monday, March 29, 2021

Shopping Discount in Java

  Machine Problem

 A departmental store offers 20% discount on shopping of 10,000 PRs. 10% discount on shopping of 5000 PRs. and no discount on shopping of less than 5000 PRs. Write a program that accepts total bill of buyer as input and calculates amount to be paid after applying discount.  Use separate functions for input, calculate discount and display total bill after discount.(java)

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com




Program Listing

/* DepartmentStore.java

 * Mr. Jake R. Pomperada, MAED-IT, MIT

 * jakerpomperada.com and jakerpomperada.blogspot.com

 * jakerpomperada@gmail.com

 * Bacolod City, Negros Occidental

 * 

 * Machine Problem

 * 

 * A departmental store offers 20% discount on shopping of 10,000 PRs. 10% discount on

*shopping of 5000 PRs. and no discount on shopping of less than 5000 PRs. Write a program that 

*accepts total bill of buyer as input and calculates amount to be paid after applying discount.

 Use separate functions for input, calculate discount and display total bill after discount.(java)

 */


import java.util.Scanner;


public class DepartmentStore {

  public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.println("\n");

    System.out.print("\t\tShopping Discount in Java");

    System.out.println("\n");

        System.out.print("\tEnter total amount: ");

        double amount = sc.nextDouble();

        double total = 0;


        if(amount >= 10000) {

            total = amount - (amount * 0.20);

            System.out.println("\tBill is eligible for a 20% discount");

        } else if (amount < 10000 && amount >= 5000) {

            total = amount - (amount * 0.10);

            System.out.println("\tBill is eligible for a 10% discount");

        } else {

            total = amount;

            System.out.println("\tBill is not eligible for a any discount");

        }


        System.out.println("\tYour total bill is: " + total);

        sc.close();

        System.out.println();

        System.out.print("\t THANK YOU FOR USING THIS PROGRAM");

        System.out.println("\n");

    }


}



No comments:

Post a Comment