0% found this document useful (0 votes)
425 views15 pages

Java Basic Calculator Project

The document describes a student project to build a basic calculator application in Java. It includes the source code for two approaches to building the calculator. The first takes user input for two numbers and an operator then uses a switch statement to perform the calculation. The second uses if/else statements to evaluate the operator and perform the calculation. The project was completed to fulfill a school practical examination requirement under a teacher's guidance.

Uploaded by

Gunu Jmt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
425 views15 pages

Java Basic Calculator Project

The document describes a student project to build a basic calculator application in Java. It includes the source code for two approaches to building the calculator. The first takes user input for two numbers and an operator then uses a switch statement to perform the calculation. The second uses if/else statements to evaluate the operator and perform the calculation. The project was completed to fulfill a school practical examination requirement under a teacher's guidance.

Uploaded by

Gunu Jmt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Session:-2022-23

PROJECT FILE: INFORMATION TECHNOLOGY(802)


Project report on
“Fundamental of JAVA Programming”

Submitted by
Siria Jamatia

Class: XII (ARTS)

Under the
guidance of
Mrs. Antara Roy.
JAVA APPLICATION

FOR

Generating

Basic Calculator

In Java

Tools used:-Jdk
CERTIFICATE

This is to certify that Siria Jamatia, Sharmila


Jamatia and Baran Jamatia Of class XII(ARTS),
has successfully completed the investigatory
project on the topic Generating Basic
Calculator in java under the guidance of Mrs.
Antara Roy during the academic year 2022-23
in the partial fulfillment of AISSCE practical
examination conducted by CBSE.

Signature of Signature of signature of


Internal examiner external examiner candidate
DECLARATION

We hereby declare that the project work


entitled generating “Date” and “Time” in java
submitted to Department of Information
Technology, Garia Academy (Model), Udaipur
is prepared by us. All the coding is result of
my personal efforts.

1. Siria Jamatia
2. Sharmila Jamatia
3. Baran Jamatia
ACKNOWLEDGMENT

We would like to express a deep sense of


thanks and gratitude to my project guide
Mrs. Antara Roy for guiding me immensely
through the course of the project. She always
evinced keep interest in our work. Her
constructive advice and constant motivation
have been responsible for the successful
compaction of this project. We also thanks to
my parents for their motivation and support
we must thanks to my classmate for their
timely help and support for complication of
this project.
INDEX

S. no Topic
1. Introduction
2. Source code
3. Output scenes
4. Bibliography
INTRODUCTION

BASIC CALCULATOR
This case study is an introduction to
making a specification with StateWORKS Studio
that will be executed by an RTDB based
application. The calculator known from Microsoft
Windows systems is taken as the application.
Although the power of the StateWORKS concept
only shows up significantly in larger projects with
many state machines, this case study, with a single
state machine, raises a number of interesting
issues, common to all StateWORKS projects. A
discussion of issues relevant to this project may be
found on the StateWORKS blog, at
www.stateworks.net. The case study gives also an
example of using the complement value. We will
learn also that StateWORKS has a RtdbClient for
C# programs.
SOURCE CODE
1. // Java program for simple calculator
import java.io.*;
import java.lang.*;
import java.lang.Math;
import java.util.Scanner;
public class BasicCalculator {

public static void main(String[] args)


{
// stores two numbers
double num1, num2;

// Take input from the user


Scanner sc = new Scanner(System.in);

System.out.println("Enter the numbers");

// take the inputs


num1 = sc.nextDouble();

num2 = sc.nextDouble();

System.out.println("Enter the operator (+,-,*,/)");

char op = sc.next().charAt(0);

double o = 0;

switch (op) {

// case to add two numbers


case '+':

o = num1 + num2;

break;
// case to subtract two numbers
case '-':

o = num1 - num2;

break;

// case to multiply two numbers


case '*':

o = num1 * num2;

break;

// case to divide two numbers


case '/':

o = num1 / num2;

break;

default:

System.out.println("You enter wrong input");


break;
}
System.out.println("The final result:");
System.out.println();
// print the final result
System.out.println(num1 + " " + op + " " + num2
+ " = " + o);
}
}
2. import java.util.Scanner;
import javax.swing.JOptionPane;

public class javaCalculator


{

public static void main(String[] args)


{
int num1;
int num2;
String operation;

Scanner input = new Scanner(System.in);

System.out.println("please enter the first number");


num1 = input.nextInt();

System.out.println("please enter the second number");


num2 = input.nextInt();

Scanner op = new Scanner(System.in);

System.out.println("Please enter operation");


operation = op.next();

if (operation == "+");
{
System.out.println("your answer is" + (num1 + num2));
}
if (operation == "-");
{
System.out.println("your answer is" + (num1 - num2));
}

if (operation == "/");
{
System.out.println("your answer is" + (num1 / num2));
}
if (operation == "*")
{
System.out.println("your answer is" + (num1 * num2));
}

}
}
OUTPUT SCENES
1.
2.
BIBLIOGRAPHY
1. https://www.javatpoint.com
2. https://www.stackoverflow.com
3. https://www.geeksforgeeks.org
  
// He
       
         

You might also like