Computer Science, asked by tae301295, 19 days ago

Ajay travels pvt. ltd gives the following discount to its customers. Find out the discount and net amount to be paid by taking customer name, ticket amount as input.

Ticket amount Discount

above 70000 18%

55001 to 70000 16%

35001 to 55000 12%


25001 to 35000 10%


less than 25001 2%


print the output in following format


Name Ticket amount Discount Net amount

_____ _________ _______ _______

xx xx xx xx


" WRITE INPUT, OUTPUT AND VARIABLE DESCRIPTION TABLE "​

Answers

Answered by Shivu516
1

Hope it helps ^_^

This program is in Java

I have also added the outputs for all the added conditions followed by a variable descriptive table

_____________________________________

import java.util.Scanner;

public class Amount_Teller{

   public static void main(String [] args){

       Scanner sc = new Scanner(System.in);

       double amt, discount = 0;

       System.out.println("Ajay Travels ticket price calculator");

       System.out.println("");

       System.out.println("Rate of discount on tickets");

       System.out.println("     Amount     " + "       Discount(%)");

       System.out.println("Amount > 70000     " + "      18%      ");

       System.out.println("Amount > 55000      " + "     16%      ");

       System.out.println("Amount > 35000      " + "     12%      ");

       System.out.println("Amount > 25000      " + "     10%      ");

       System.out.println("Amount < 25000       " + "     2%      ");

       System.out.println("");

       System.out.print("Enter the initial price for the ticket: ");

       amt = sc.nextDouble();

       // Most important part comes here

       if (amt > 70000)

       discount = 0.18 * amt;

       else if (amt > 55000 && amt <= 70000)

       discount = 0.16 * amt;

       else if (amt > 35000 && amt <= 55000)

       discount = 0.12 * amt;

       else if (amt > 25000 && amt <= 35000)

       discount = 0.1 * amt;

       else

       discount = 0.02 * amt;

       //System.out.println(discount);

       System.out.println("Discount: " + discount);

       System.out.println("Total amount to be paid: " + (amt - discount));

       System.out.println("");

       System.out.println("Thanks for giving us the opportunity to serve you");

       System.out.println("Looking forward to your next visit ^_^");

       System.out.println("                                 -Team Ajay Travels");

   }

}

_____________________________________

I also added outputs for all the added conditions in order to make the answer even lengthier

The underlined parts are the inputs

Outputs:

(i)

Ajay Travels ticket price calculator

Rate of discount on tickets

    Amount            Discount(%)

Amount > 70000           18%      

Amount > 55000           16%      

Amount > 35000           12%      

Amount > 25000           10%      

Amount < 25000            2%      

Enter the initial price for the ticket: 100000

Discount: 18000.0

Total amount to be paid: 82000.0

Thanks for giving us the opportunity to serve you

Looking forward to your next visit ^_^

                                -Team Ajay Travels

(ii)

Ajay Travels ticket price calculator

Rate of discount on tickets

    Amount            Discount(%)

Amount > 70000           18%      

Amount > 55000           16%      

Amount > 35000           12%      

Amount > 25000           10%      

Amount < 25000            2%      

Enter the initial price for the ticket: 60000

Discount: 9600.0

Total amount to be paid: 50400.0

Thanks for giving us the opportunity to serve you

Looking forward to your next visit ^_^

                                -Team Ajay Travels

(iii)

Ajay Travels ticket price calculator

Rate of discount on tickets

    Amount            Discount(%)

Amount > 70000           18%      

Amount > 55000           16%      

Amount > 35000           12%      

Amount > 25000           10%      

Amount < 25000            2%      

Enter the initial price for the ticket: 40000

Discount: 4800.0

Total amount to be paid: 35200.0

Thanks for giving us the opportunity to serve you

Looking forward to your next visit ^_^

                                -Team Ajay Travels

(iv)

Ajay Travels ticket price calculator

Rate of discount on tickets

    Amount            Discount(%)

Amount > 70000           18%      

Amount > 55000           16%      

Amount > 35000           12%      

Amount > 25000           10%      

Amount < 25000            2%      

Enter the initial price for the ticket: 30000

Discount: 3000.0

Total amount to be paid: 27000.0

Thanks for giving us the opportunity to serve you

Looking forward to your next visit ^_^

                                -Team Ajay Travels

(v)

Ajay Travels ticket price calculator

Rate of discount on tickets

    Amount            Discount(%)

Amount > 70000           18%      

Amount > 55000           16%      

Amount > 35000           12%      

Amount > 25000           10%      

Amount < 25000            2%      

Enter the initial price for the ticket: 20000

Discount: 400.0

Total amount to be paid: 19600.0

Thanks for giving us the opportunity to serve you

Looking forward to your next visit ^_^

                                -Team Ajay Travels

Attachments:
Similar questions