Skip to content
Open
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
12 changes: 12 additions & 0 deletions Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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 int divide(int a, int b) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to nit pick, Let's remove this extra line

Suggested change

if (b == 0 ) throw new ArithmeticException("Invalid operation ");


return a / b;
}
}
12 changes: 12 additions & 0 deletions calcu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Calcu{
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 int divide(int a, int b) {

if (b == 0 ) throw new ArithmeticException("Invalid operation ");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, remove extra line :)

Suggested change


return 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 age;
public Student(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}

public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
}