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
Answer:
if you could tell which language would be nice
assuming it's java:
import java.util.*;
class gift
{
public static void main(String args[])
{
Scanner sn= new Scanner(System.in);
int quan,price,total;
String gift="";
System.out.println("enter price of item");
price= sn.nextInt();
System.out.println("Enter quantity of item");
quan= sn.nextInt();
total=price*quan;
if(total>=100 && total<500){
gift="a Key Ring";
}
else if(total>=500 && total<1000){
gift="A leather purse";
}
else if(total>=1000){
gift="a pocket calculator";
}
else{
gift="not available for price range";
}
System.out.println(" Product Price "+price+"\n Product Quantity "+ quan+"\n Total "+total+"rs \n Gift:"+gift);
System.out.println("Thank you!!");
}
}