0% found this document useful (0 votes)
16 views3 pages

Java Simple Calculator Program

The document describes a Java program that functions as a simple calculator, allowing users to perform basic arithmetic operations (addition, subtraction, multiplication, and division) on two numbers. It highlights the program's inputs, outputs, features, and constraints, while noting the use of conditional statements for operation selection. Additionally, it includes reflections on the project's impact, complexity of Java compared to Python, and suggestions for future improvements.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Java Simple Calculator Program

The document describes a Java program that functions as a simple calculator, allowing users to perform basic arithmetic operations (addition, subtraction, multiplication, and division) on two numbers. It highlights the program's inputs, outputs, features, and constraints, while noting the use of conditional statements for operation selection. Additionally, it includes reflections on the project's impact, complexity of Java compared to Python, and suggestions for future improvements.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

George:

import [Link];

public class Main {


public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);

[Link]("Enter the first number");


double num1 = [Link]();
[Link]("Enter the second number");
double num2 = [Link]();
[Link]("What do you want to do multiply, divide, addition, or subtract?(must use
the specific words from the sentences abbreviations will not work)");
String operation = [Link]();
if ([Link]("multiply")){
double result = num1 * num2;
[Link]("The multiplication of "+num1+" and "+num2+" is "+result);
}else if ([Link]("Multiply")){
Double result = num1 * num2;
[Link]("The multiplication of "+num1+" and "+num2+" is "+result);
}else if ([Link]("divide")){
double result = num1 / num2;
[Link]("The division of "+num1+" and "+num2+" is "+result);
}else if ([Link]("Divide")){
double result = num1 / num2;
[Link]("The division of "+num1+" and "+num2+" is "+result);
}else if ([Link]("addition")){
double result = num1 + num2;
[Link]("The addition of "+num1+" and "+num2+" is "+result);
}else if ([Link]("Addition")){
double result = num1 + num2;
[Link]("The addition of "+num1+" and "+num2+" is "+result);
}else if ([Link]("subtraction")){
double result = num1 - num2;
[Link]("The Subtraction of "+num1+" and "+num2+" is "+result);
}else if ([Link]("Subtraction")){
double result = num1 - num2;
[Link]("The subtraction of "+num1+" and "+num2+" is "+result);
}
}
}

The objective of this project is to be able to use it as a calculator for simple equations that
consist of two numbers and can include decimals. The problem that this code is solving is the
inability to do a simple equation such as 9.2*7.8 as this is hard to do mentally you need a
calculator. Therefore this code solves the problem of not being able to do certain mathematical
equations. In this code, we have various inputs, features, outputs and constraints. The inputs
that we have are: the first number which the user inputs, the second number which the user also
inputs and finally the operation they want to do which the user also dictates. Alongside these
inputs, we have one output which is the result of the equation which they create by giving the
code two numbers and an operation. This code contains 4 features, multiplication, division,
addition and subtraction. However, the code has a few constraints such as the values of Num1
& Num2, the operation and the result. This code doesn't use any loops as they're not necessary,
on the other hand, it uses conditional statements such as if & else if to determine what
operations to use based on the user's decision. In the code we can find the “Scanner” which is
what we use to handle inputs from the user.

Alessandro:
Impact:
This project really does meet the needs of the users, making a comfortable access to a
calculator.
Conclusion:
Findings on this project were important to create the code, we discovered Java is more complex
than Python, but when we already know how it works, there’s more possibilities for everything.
Know we know why big companies use Java and that it will be useful for the future.

Marc’s part:
Evaluation: • Reflect on what worked well and what could have been improved.

Improvement: • Consider adding additional features which you think you can add in your project
in future.

Impact: • Discuss how the project meets the needs of its users.

Conclusion: • Summarize findings and reflect on the project experience. • Discuss lessons
learned and areas for future growth.

You might also like