Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class Calculator {
public int add(int a, int b) {
return a + b;
}

public int subtract(int a, int b) {
return a - b;
}

public int multiply(int a, int b) {
return a * b;
}

public double divide(int a, int b) {
if (b == 0) {
throw new IllegalArgumentException("Division by zero is not allowed.b can't be zero.");
}
return (double) a / b;
}
}
21 changes: 21 additions & 0 deletions Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class Student{
private String name;
private int id;

public Student(String name, int id){
this.name = name;
this.id = id;
}
public String getName(){
return name;
}
public int getId(){
return id;
}
public void setName(String name){
this.name = name;
}
public void setId(int id){
this.id = id;
}
}
Loading