coderrohan14

Conditionals_Ques_3.java

Jun 24th, 2021 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. String cid = sc.next(),cName = sc.next();
  7. double litres = sc.nextDouble();
  8. double cost=0;
  9. if(litres<200){
  10. cost = litres*3;
  11. }else if(litres>=200&&litres<400){
  12. cost = litres*3.35;
  13. }else if(litres>=400&&litres<600){
  14. cost = litres*4.80;
  15. }else{
  16. cost = litres*5.10;
  17. }
  18. if(cost>1250){
  19. cost+=(cost*15)/100;
  20. }
  21. System.out.println(cid);
  22. System.out.println(cName);
  23. System.out.println((long)litres);
  24. System.out.println((long)cost);
  25. }
  26. }
  27.  
Add Comment
Please, Sign In to add comment