Guest User

Untitled

a guest
Jan 2nd, 2019
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CalculateDiscount {
  4. public static void main(String[] args) {
  5. Scanner user_input = new Scanner(System.in);
  6.  
  7. Integer n = Integer.parseInt(user_input.nextLine());
  8. Double item_price = 0.0;
  9. Double discounted_price[] = new Double[n];
  10.  
  11. for (int i = 0; i < n; i++) {
  12. item_price = Double.parseDouble(user_input.nextLine());
  13. discounted_price[i] = item_price - item_price * 0.65;
  14. }
  15.  
  16. for (int j = 0; j < discounted_price.length; j++) {
  17. System.out.printf("%.2f\n", discounted_price[j]);
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment