COMP2396
Loading...
Searching...
No Matches
ElectronicsProduct.java
Go to the documentation of this file.
1package tutorial4.part2;
2
3/**
4 * ElectronicsProduct class with attributes for product ID, name, and price.
5 */
6public class ElectronicsProduct {
7 private final String productId;
8 private final String name;
9 private double price;
10
11 public ElectronicsProduct(String productId, String name, double price) {
12 this.productId = productId;
13 this.name = name;
14 this.price = price;
15 }
16
17 public void applyDiscount(int discount) {
18 price = price * (100 - discount) / 100;
19 }
20
21 public String getProductId() {
22 return productId;
23 }
24
25 public String getName() {
26 return name;
27 }
28
29 public double getPrice() {
30 return price;
31 }
32}
ElectronicsProduct class with attributes for product ID, name, and price.
ElectronicsProduct(String productId, String name, double price)