Skip to content

Suggestion to amina #1

@HermelaDemeke

Description

@HermelaDemeke

Feedback: firstly, I appreciate your code because of it's easiness to understand. I see that you have provided the code for the purpose of calculator(), method(), logical operation, class creation and iteration as well. however, I just noticed a couple of things that needs clarification and a little bit improvement.

  1. In the calculator() method, you have declared two variable which is (number1 and number2) but they are not used in the calculations. instead you directly use the numbers(24 & 12) in your calculation. so to make it clear you can revise your code like this:
    System.out.println ("the sum of "number1+"and "+number2+ "is " + (number1+ number2));
    System.out.println ("The difference of "number1+"and "+number2+ "is " + (number1- number2));
    System.out.println ("the product of "number1+"and "+number2+ "is " + (number1* number2));
    System.out.println ("the quotient of "number1+"and "+number2+ "is " + (number1/ number2));

  2. In the iteration() method in your code you try to use for loop and while loop to perform a repetitive task however, in the for loop you iterate from i=2 to i<=10 and you want to print only even number so to make it clear that you want to display even number you can change the loop condition to i<=10 and increment i by 2 in each iteration.
    for (int i = 2; i <= 10; i += 2) {
    System.out.println(i);
    }

  • other than that, your code looks great! it provides a simple menu that allows the user to choose different options and performs various calculations and logical operations based on the chosen option. for more clarification, I just attached a simple video that guide you to perform what i am saying..
Sum.Subtraction.Multiplication.Division.Remainder.Two.Number.in.java.Java.Programming.1.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions