Challenge

Project


import java.util.Scanner;

import Functions.Division;
import Functions.Logn;
import Functions.Logvalue;
import Functions.Multiplication;
import Functions.RaisedToPower;
import Functions.SIP;
import Functions.SquareRoot;
import Functions.Substraction;
import Functions.addition;
import Functions.b2d;
import Functions.cos;
import Functions.d2b;
import Functions.icos;
import Functions.isin;
import Functions.itan;
import Functions.nthRoot;
import Functions.sin;
import Functions.tan;
import HistoryProcessing.DeleteHistory;
import HistoryProcessing.ReadHistory;
public class MainCalci {
public static void main(String[] args)
{
SymbolsOfOperation.getListOfSymbolsOfOperation();
Scanner sc = new Scanner(System.in);
int choice=21;
String stor = null;
while (true)
{
System.out.println("SCIENTIFIC CALCULATOR");
System.out.println("Please Choose Your Operation :");
SelectChoice.selectchoice(choice);
choice=SelectChoice.selecting;
if (choice == 1)
addition.add();
else if (choice == 2)
Substraction.minus();
else if (choice == 3)
Multiplication.multiplication11();
else if (choice == 4)
Division.division1();
else if (choice == 5)
RaisedToPower.power11();
else if (choice == 6)
SquareRoot.sroot();
else if (choice == 7)
nthRoot.nthRoot11();
else if (choice == 8)
Logvalue.log1();
else if (choice == 9)
Logn.logn1();
else if (choice == 10)
sin.sin11();
else if (choice == 11)
isin.isin1();
else if (choice == 12)
cos.cos1();
else if (choice == 13)
icos.icos1();
else if (choice == 14)
tan.tan11();
else if (choice == 15)
itan.itan1();
else if (choice == 16)
{
System.out.println("Enter the value :");
sc.nextLine();
stor = sc.nextLine();
}
else if (choice == 17)
System.out.println("The Stored Value :"+stor);
else if (choice == 18)
d2b.d2b();
else if (choice == 19)
b2d.b2d1();
else if (choice == 20)
SIP.SIP11();
else if (choice == 21)
ReadHistory.readHistory();
else if (choice == 22)
{
DeleteHistory.deleteHistory();
break;
}
else if (choice == 23)
break;
else
{
System.out.println("Invalid Input Please Try Again!!!");
}
}
}
}

import java.util.Scanner;

public class SelectChoice {
public static int selecting;

public static void selectchoice(int choice){
Scanner sc = new Scanner(System.in);

try{
selecting = sc.nextInt();

}catch (Exception e){
e.getMessage();

}

}
}


public class SymbolsOfOperation {
static String Operation[] = {"+","-","*","/","^","Sqrt","Nrt","log","logn","sin","isin","cos","icos","tan","itan","stor","recall","d2b","b2d","sip","Calc. History","Delete History & Close","close"};


public static void getListOfSymbolsOfOperation(){

System.out.println(" Operation number list are as follows :");

for (int i=1;i<Operation.length+1;i++)
{
System.out.println(i+". "+Operation[i-1]);

}
}

}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class addition {
public static void add() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter two numbers:");
try
{
double i = sc.nextDouble();
double j = sc.nextDouble();
String Output = (i +" + "+j+ " = "+(i+j)+ "\n");
System.out.println(Output);
PrintHistory.printHistory(Output);
}
catch(Exception e)
{
System.out.println("Invalid input Please Try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;

public class b2d {
static Scanner sc = new Scanner(System.in);
public static void b2d1()
{
System.out.println("Entre The Binary Number:");
try
{
String i = sc.nextLine();
int decimal=Integer.parseInt(i,2);
String output = ("(Binary) "+i +" b2d = "+ decimal +"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input. please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;

public class cos {

static Scanner sc = new Scanner(System.in);
public static void cos1(){
System.out.println ("Enter the value in degree:");

try{ double i = sc.nextDouble();

String result = ("cos "+i+" = "+Math.cos(Math.toRadians(i))+"\n");
System.out.println(result);
PrintHistory.printHistory(result);
}
catch(Exception e){

System.out.println("Invalid input. please try again!");
e.getMessage();
}

}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class d2b {
static Scanner sc = new Scanner(System.in);
public static void d2b()
{
System.out.println("Entre decimal number :");
try
{
int i = sc.nextInt();
String Binary=Integer.toBinaryString(i);
String output = ("(Decimal) "+i+" d2b = "+Binary+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid output");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class Division {

static Scanner sc = new Scanner(System.in);
public static void division1()
{
System.out.println("Enter two number");
try
{
double i = sc.nextDouble();
double j = sc.nextDouble();
try
{
String output = (i+" / "+ j +" = "+(i/j)+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch (Exception e)
{
e.getLocalizedMessage();
}
}
catch(Exception e){
System.out.println("Invalid input Please Try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class icos {
static Scanner sc = new Scanner(System.in);
public static void icos1(){
System.out.println("Enter the Value:");
try
{
double i = sc.nextDouble();
double ans =Math.toDegrees(Math.acos(i));
String output = ("icos "+i+" = "+ans+" degree\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid Input.please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class isin {
static Scanner sc = new Scanner(System.in);
public static void isin1()
{
System.out.println("Enter The Value :");
try
{
double i = sc.nextDouble();
double ans =Math.toDegrees(Math.asin(i));
String output = ("isin "+i+" = "+ans+" degree\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid Input. please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class itan {
static Scanner sc = new Scanner(System.in);
public static void itan1()
{
System.out.println("Enter the Value :");
try
{
double i = sc.nextDouble();
double ans =Math.toDegrees(Math.atan(i));
String output = ("itan "+i+" = "+ans+" degree\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid Input. please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class Logn {

static Scanner sc = new Scanner(System.in);
public static void logn1()
{
System.out.println("Enter the value:");
try
{
double i = sc.nextDouble();
String output = ("ln"+i+" = "+Math.log(i)+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e){

System.out.println("Invalid input. please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class Logvalue {
static Scanner sc = new Scanner(System.in);
public static void log1()
{
System.out.println("Enter The Numbers :");
try
{
double i = sc.nextDouble();
String output = ("log (base 10) "+i+" = "+ Math.log10(i) +"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid Input.please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class Multiplication {
static Scanner sc = new Scanner(System.in);
public static void multiplication11()
{
System.out.println("Enter any two numbers");
try
{
double i = sc.nextDouble();
double j = sc.nextDouble();
String output = (i+" x "+j+" = "+(i*j)+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input Please Try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class nthRoot {
static Scanner sc = new Scanner(System.in);
public static void nthRoot11()
{
System.out.println("Enter any two numbers:");

try
{
double i = sc.nextDouble();
System.out.println("Enter Value Of n :");
double j = sc.nextDouble();
String output = (i+"^(1/"+j+")"+" = "+Math.pow(i,(1/j))+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class RaisedToPower {

static Scanner sc = new Scanner(System.in);
public static void power11(){

System.out.println("Enter the number:");
try
{
double i = sc.nextDouble();
System.out.println("Entre The Power :");
double j = sc.nextDouble();
String output = (i+"^"+j+" = "+Math.pow(i,j)+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class sin {
static Scanner sc = new Scanner(System.in);
public static void sin11()
{
System.out.println("Entre Angle in Degree :");
try
{
double i = sc.nextDouble();
String output = ("sin "+i+" = "+Math.sin(Math.toRadians(i))+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input.please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class SIP {
static Scanner sc = new Scanner(System.in);
public static void SIP11() {
System.out.print("Enter the amount which is invested: ");
try
{
double p=sc.nextInt();
System.out.print("Enter interest rate: ");
double r=sc.nextInt();
System.out.print("Enter Number of installments: ");
double y=sc.nextInt();
double x=r+1;
double f=(p*((Math.pow(x,y)-1))/r*x);
String output = ("(P="+p+" , r="+r+" , y="+y+")SIP="+f+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input.please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;
import HistoryProcessing.PrintHistory;
public class SquareRoot {
static Scanner sc = new Scanner(System.in);
public static void sroot()
{
System.out.println("Enter The Numbers:");
try
{
double i = sc.nextDouble();
String output = (i+"^(0.5)"+" = "+Math.pow(i,0.5)+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input.please try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class Substraction {
static Scanner sc = new Scanner(System.in);
public static void minus()
{
System.out.println("Entre two numbers :");
try
{
double i = sc.nextDouble();
double j = sc.nextDouble();
String Output= (i+" + "+j+" = "+(i-j)+"\n");
System.out.println(Output);
PrintHistory.printHistory(Output);
}
catch(Exception e)
{
System.out.println("Invalid input Please Try again!");
e.getMessage();
}
}
}

package Functions;
import java.util.Scanner;

import HistoryProcessing.PrintHistory;
public class tan {
static Scanner sc = new Scanner(System.in);
public static void tan11()
{
System.out.println("Entre The Angle in Degree :");
try
{
double i = sc.nextDouble();
String output = ("tan "+i+" = "+Math.tan(Math.toRadians(i))+"\n");
System.out.println(output);
PrintHistory.printHistory(output);
}
catch(Exception e)
{
System.out.println("Invalid input.please try again!");
e.getMessage();
}
}
}

package HistoryProcessing;
import java.io.File;
public class DeleteHistory
{
public static void deleteHistory()
{
File CalculatorHistory = new File("");
if(CalculatorHistory.delete())
System.out.println("Deleted");
else
System.out.println("Not Deleted.please try again!");
}
}

package HistoryProcessing;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class PrintHistory
{
public static void printHistory(String history)
{
BufferedWriter bw;
{
try
{
bw = new BufferedWriter(new FileWriter("C:\\Users\\Neel Shewale\\OneDrive\\Desktop\\work space\\ScientificCalculator",true));
bw.write(history);
bw.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}

package HistoryProcessing;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class ReadHistory {
public static void readHistory()
{
BufferedReader br;
{
try
{
br = new BufferedReader(new FileReader(" "));
String history;
while((history= br.readLine())!=null)
{
System.out.println(history);
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.