AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Soumya and his Food Coupon

A shop advertises that all customers buying three items with the second item priced as an even number will get a discount provided the total purchase is at least for Rs. 1000. Given three price values, your program should output:
Discount available for 403 500 99
or
Discount not available for 403 500 99.

Soumya has a bad habit of losing his Food Coupons so help Soumya to decide the items he should buy and finish the coupones. He will enter three number and find that whether he will get the discount or not.

corejava x 352
programming x 168
Posted On : 2016-11-07 13:24:30.0
profile Akash Prasad - anyforum.in Akash Prasad
2550
up-rate
2
down-rate

Answers


import java.util.Scanner;

public class FoodCoupon {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
try{
int item1=input.nextInt();
int item2=input.nextInt();
int item3=input.nextInt();
System.out.print("Discount");
if(!(item2%2==0 && (item1+item2+item3)>=1000)){
System.out.print(" not");
}
System.out.print(" available for "+item1+" "+item2+" "+item3);
}catch (Exception e) {
e.printStackTrace();
}
}
}

Posted On : 2016-11-10 22:06:47
Satisfied : 0 Yes  1 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523188222108
Reply This Thread
up-rate
3
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in