Advertisement
Vladkoheca

Order.java

Dec 6th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | Source Code | 0 0
  1. public class Order {
  2.     public String orderId;
  3.     public double price;
  4.  
  5.     public Order(String orderId, double price) {
  6.         this.orderId = orderId;
  7.         this.price = price;
  8.     }
  9.     public void displayInfo() {
  10.         System.out.println("The order id is: " + orderId + "\nThe price of the order is: " + price);
  11.     }
  12.     public double applyDiscount(double discountPercentage) {
  13.         return price - (discountPercentage / price * 100);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement