Design a program in Java to calculate the discount given to a customer on purchasing LED Television. The program also displays the amount paid by the customer after discount. The details are given as:
Class name : Television
Data members: int cost, int discount, int amount
Member functions:
Accept( ) : to input the cost of Television
Calculate( ) : to calculate the discount
Display( ) : to show the discount and the amount paid after discount

Short Answer
Views 22

Answer:


class Television {
    int cost;
    int discount;
    int amount;

    void Accept() {
        /*
         * Input the cost
         * of Television
         */
    }

    void Calculate() {
        /*
         * Calculate the discount
         */
    }

    void Display() {
        /*
         * Show the discount and
         * the amount paid
         * after discount
         */
    }
}

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.