Computer Science, asked by sinchanaau, 16 days ago

Input the quantity purchased and the rate. Calculate the total purchase price and display it along with
the gift to be presented. The gifts to the customers are given as under:
Amount of Purchase (Rs.) Gift
100 and above but less than 500 A key ring
500 and above but less than 1000 A leather purse
1000 and above A pocket calculator
The application will end with a 'Thank you' message.

Answers

Answered by kamalraj1469
0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args)

{

   

    Scanner input=new Scanner(System.in);

   

    System.out.println("enter the item number");

    int itmno = input.nextInt();

               System.out.println("enter the quantity purchased");

    int qty = input.nextInt();

    System.out.println("enter the rate");

    int rate = input.nextInt();

       int tp = qty*rate;

       System.out.println();

       System.out.println("Item number: "+itmno);

       System.out.println("Total cost: "+tp);

   

   if (tp >=100 && tp<500)

   {

    System.out.println("Congratulations! You get a free Key Ring!");

   }

   else if(tp >=500 && tp<1000)

   {

      System.out.println("Congratulations! You get a free Leather Purse!");

   }

   else if(tp >=1000)

{

       System.out.println("Congratulations! You get a free Pocket Calculator!");

}

System.out.println("THANK YOU");

  }

  }

compile this program to get the solution

Explanation:

Similar questions