-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer1.java
More file actions
55 lines (42 loc) · 1.13 KB
/
Customer1.java
File metadata and controls
55 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Customer {
int customerID;
String customerName;
Customer(int id, String name) {
this.customerID = id;
this.customerName = name;
}
void addCustomer() {
System.out.println("Customer added: " + customerName);
}
void deleteCustomer() {
System.out.println("Customer deleted: " + customerID);
}
}
// Reverse Engineering wala class
class Product {
int productID;
String productName;
Product(int id, String name) {
this.productID = id;
this.productName = name;
}
void addProduct() {
System.out.println("Product added: " + productID);
}
void selectProduct() {
System.out.println("Product selected: " + productID);
}
}
// Main class (sirf ek hi hoga)
public class Customer1{
public static void main(String[] args) {
// Forward Engineering (Customer)
Customer c = new Customer(101, "Raj Sharma");
c.addCustomer();
c.deleteCustomer();
// Reverse Engineering (Product)
Product p = new Product(211, "Laptop");
p.addProduct();
p.selectProduct();
}
}