リンクを新しいタブで開く
  1. 元に戻す
    やり直し
    コピー
    エクスポート
    書き換え
    テスト ツール
    その他のアクション
    • 作業報告
    • メール
    • リライト
    • スピーチ
    • タイトル ジェネレーター
    • スマート返信
    • エッセイ
    • ジョーク
    • Instagram 投稿
    • X 投稿
    • Facebook 投稿
    • ストーリー
    • 添え状
    • 履歴書
    • 職務明細書
    • 推薦状
    • 退職願
    • 招待状
    • グリーティング メッセージ
    • その他のテンプレートを試します
  1. To calculate the discount on a product in Java, you can use the formula:

    Discounted Price = Original Price - (Original Price × Discount Rate / 100)

    Here's an example program that calculates the discounted price based on user input:

    import java.util.Scanner;

    public class DiscountCalculator {
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    // Input: Original price and discount rate
    System.out.print("Enter the original price: ");
    double originalPrice = scanner.nextDouble();

    System.out.print("Enter the discount percentage: ");
    double discountRate = scanner.nextDouble();

    // Calculate discounted price
    double discountAmount = (originalPrice * discountRate) / 100;
    double finalPrice = originalPrice - discountAmount;

    // Output: Discount amount and final price
    System.out.println("Discount Amount: $" + discountAmount);
    System.out.println("Final Price after Discount: $" + finalPrice);

    scanner.close();
    }
    }
    コピーしました。

    Key Points:

    フィードバック
    ありがとうございました!詳細をお聞かせください
  2. 割引価格を計算する Java プログラムを作成する

    割引価格を計算する Java プログラム: このチュートリアルでは、割引後の製品の価格を計算する方法を学びます。 ユーザーから両方の入力を受け取ります。 割引後の価格の計算: 割引後の最終価格を計 …

  3. Java Program To Calculate Discount Of Product

    2025年11月27日 · A: Discount is defined as the reduction in the price something you sell to the customers. Most of the discount rate is given in percentage rate. …

  4. 他の人も質問しています
  5. Find Discount in Java | AlgoCademy

    Learn "Find Discount in Java" with our free interactive tutorial. Master this essential concept with step-by-step examples and practice exercises.

  6. Write a Java program to calculate Discount Price - CodeVsColor

    To calculate the final price after the discount, we will have to multiply the actual price with the discount and subtract this from the original price e.g. if the actual price is 300 and the discount is 10%, the final price will be: 300 - (300 * 10/100). 10% discount will get you a discount of 10 for a product priced at 100. For a product priced at...
    codevscolor.com でさらに表示
  7. Java Discount Calculation - Stack Overflow

    2016年7月6日 · Assuming discount is by whole number and not percentage then the code should be something like double afterDiscount = item[i].getItemPrice() - item[i].getItemDiscount();

    コード サンプル

    item[2] = new Item(3, "c", 300.0, 40.0);
    item[3] = new Item(4, "d", 400.0, 390.0);
    item[4] = new Item(5, "e", 500.0, 60.0);
    Item cheapest = getLeastPriceItem(item);
    System.out.println("Least item price: "+ cheapest.getItemPrice() + " with discount of: " + cheapest.getItemDiscount());...
    stackoverflow についてさらに表示
    フィードバック
    ありがとうございました!詳細をお聞かせください
  8. Javaでメソッドやif文を利用して税込み金額と ... - teratail

    2022年3月12日 · コマンドラインから受け取った数字を利用して税金込みの金額と割引後の金額を算出したいのですが、discountの部分がうまくかけずに困っているのでご教授頂きたいです。 割引の条 …

  9. Calculate Discounts in Java - CodePal

    2023年11月16日 · Learn how to calculate discounts in Java with this utility class. Calculate discount amount, discounted price, and discount percentage easily.

  10. Basic-java-programs/Method to calculate Discount at main - GitHub

    2025年1月24日 · Java program to calculate the discount of a product. With the help of the following program, you can calculate the discount on a product instantly. How to calculate a discount on a …

  11. Java formula to compute discount dynamically - Dev solutions

    2023年2月11日 · In Java, division between two integers performs integer division by default, so you can calculate the number of "groups of 3" like so.

  12. Program to find the Discount Percentage - GeeksforGeeks

    2023年4月18日 · The mathematical formula to calculate the Discount Percentage for the product is: Discount = Marked Price - Selling price Therefore, Discount Percentage = (Discount / Marked Price) * …