Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CalculateDiscount {
- public static void main(String[] args) {
- Scanner user_input = new Scanner(System.in);
- Integer n = Integer.parseInt(user_input.nextLine());
- Double item_price = 0.0;
- Double discounted_price[] = new Double[n];
- for (int i = 0; i < n; i++) {
- item_price = Double.parseDouble(user_input.nextLine());
- discounted_price[i] = item_price - item_price * 0.65;
- }
- for (int j = 0; j < discounted_price.length; j++) {
- System.out.printf("%.2f\n", discounted_price[j]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment