Advertisements

Write a program in java to enter the amount spend print the gift according

   AMOUNT          GIFT
1.>=500                 Key Ring
2.>500&>=1000    Leather Purse
3.<=1001               Pocket Calculator

import java.util.Scanner;
class gift
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int amt;
System.out.println("enter the amount:");
amt=sc.nextInt();
if(amt>=500)
System.out.println("Your Gift is A Key Ring :-)");
else if(amt>=501&&amt>=1000)
System.out.println("Your Gift is A Leather Purse:-)");
else
System.out.println("Your Gift is A Pocket Calculator:-)");
}