Skip to main content

Questions tagged [calculator]

This tag is for questions about calculators.

Filter by
Sorted by
Tagged with
32 votes
7 answers
7k views

Car crash reaction time

In physics class we are doing an investigation thing. Some of the numbers might seem plucked out of thin air but they aren't. The maths is right(I think) I just want some feedback on the code. ...
Danny's user avatar
  • 321
26 votes
3 answers
2k views

"The python that ate a calculator"

In a YouTube video I watched, the speaker said it is important to know how to calculate between numbers of different bases; i.e. two, ten, and sixteen. I was then inspired to write a small C program ...
motoku's user avatar
  • 2,521
26 votes
4 answers
5k views

Poor man's JIT using nested lambdas

While answering this code review question, I came up with a way to convert an equation given at runtime to a std::function<double(double)> that would evaluate ...
G. Sliepen's user avatar
  • 58.3k
25 votes
3 answers
3k views

Simple object-oriented calculator

After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this? ...
Nelson Teixeira's user avatar
24 votes
4 answers
2k views

My first calculator

I've just wrote my first code, which is basically a calculator. Please rate it and suggest improvements (keeping in mind that I'm a beginner). ...
Inteemum Ahsan's user avatar
20 votes
2 answers
454 views

Calculator Snippet CC

The April 2015 Community Challenge requires building a calculator. Implement a simple calculator Where the definition of "simple" is whatever you make it - only supports basic arithmetic ...
rolfl's user avatar
  • 97.4k
19 votes
2 answers
591 views

Newborn pythonic calculator

Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge. Please review the ...
skiwi's user avatar
  • 10.6k
18 votes
5 answers
45k views

Simple calculator in C

I made a very simple calculator in C that allows the user to perform calculations like addition, subtraction, multiplication and division. This is my first C program that I've made outside of my ...
Daniel Morris's user avatar
16 votes
3 answers
890 views

Super calculator in C

For my mathematical research, I am to deal with very large numbers and I know that the standard C types are not going to stand a chance against them due to their limited capacity, so I decided to ...
machine_1's user avatar
  • 581
15 votes
4 answers
7k views

Body Mass Index Calculator

I created a quick calculator in Javascript and I was wondering if there was a way to make the code look prettier or make it simpler. To me, it looks really cramped and messy and I'm not sure how ...
Phoenix1355's user avatar
15 votes
4 answers
4k views

Calculator in C++

I made a calculator in C++. I wanted to ask is this code well written, understandable, and alright. ...
XYBOX's user avatar
  • 69
15 votes
2 answers
135k views

Swing calculator - first GUI program

I've recently made a calculator using Java and Swing. I'm okay with the results but I'm curious what are the major flaws I've made (assuming there are, because it is my first program making GUI). I ...
JustAnEuropean's user avatar
15 votes
2 answers
99k views

Very basic calculator using methods

I have made a basic calculator using methods. This is my first attempt at using methods and would like to see if I can improve on this as there is a lot of repeated code. ...
Niall Szalkai's user avatar
15 votes
4 answers
8k views

Credit Calculator

The code has been test to work by the parameters listed below I just wanted to know if there were any details that I missed or blatantly overlooked. Develop a Java application that determines ...
WXHXIXTE's user avatar
  • 151
15 votes
2 answers
10k views

Generic Calculator and Generic Number

.NET does not support generic numbers. It is not possible to enforce a generic method with generic argument T that T is a number. The following code will simply not compile: ...
Martin Mulder's user avatar
14 votes
3 answers
7k views

BMI calculator in python using if statements

I am a beginner in the python language. I wrote a BMI calculator and I am wondering if there are any improvements I could make to the code. This is the code below: ...
Somtobechukwu Paul's user avatar
14 votes
3 answers
2k views

Circumference and Area of a Circle in COBOL

I recently started Learning COBOL from Lynda and this is my code for the first challenge . The Objective is that the user will provide the radius and we have to calculate the Circumference and the ...
Aswin Mohan's user avatar
14 votes
3 answers
7k views

Hello There Calculator

The open source project I work on uses Antlr4 pretty heavily, but I don't know much about it. I thought I would use April's Community Challenge as an opportunity to learn something about grammars, ...
RubberDuck's user avatar
  • 30.8k
13 votes
2 answers
10k views

Calculator using class templates

I've just completed an assignment about class templates in C++. It works fine and produces the correct output. We were given the main function and had to construct and implement the class. I'm ...
kemotoe's user avatar
  • 233
13 votes
2 answers
14k views

+, -, *, /, () expression calculator

In an effort to understand how compilers work, I wrote a simple expression calculator in C#. A CalculatorExpression takes an infix string, converts the infix string ...
rookie's user avatar
  • 1,233
12 votes
5 answers
21k views

Java Fraction Calculator

I validate this program for Non numeric inputs x/0 type fractions 0/0 and 0/y type fractions x/1 and x/x type fractions -x/-y and x/-y type fractions I'd ...
Gigal's user avatar
  • 121
12 votes
4 answers
183k views

Simple Java calculator

I am a beginner in Java programming. Here is my simple calculator. I hope you could scan through my coding and let me know if there is any error in my coding or how I could simplify the code. ...
Isaac's user avatar
  • 121
12 votes
3 answers
3k views

Three-function calculator

I'm pretty new to C# and was just wondering if there is a better way I can write this calculator that I made: ...
Axioms's user avatar
  • 123
12 votes
5 answers
9k views

Simple Java calculator using Swing

This is a Java calculator I made for my programming class. I know there must be vast room for improvement. Please bear in mind the fact that this only accepts an integer, then an operator, then ...
user avatar
12 votes
5 answers
4k views

My first C program: quadratic formula calculator code

Recently I've started to learn the C programming language. This is my first program which finds zero places of quadratic formulas. Doesn't parse, just gets the discriminants, counts delta and x1, x2. <...
Cholewka's user avatar
  • 221
12 votes
4 answers
3k views

Reverse Polish Notation (RPN) Calculator

I am trying to solve a codewar challenge (link): Your job is to create a calculator which evaluates expressions in Reverse Polish notation. For example expression ...
Mutism Nano's user avatar
12 votes
3 answers
1k views

Console calculator for 2 numbers at a time

I'm learning to code for fun, and just finished my first program. I don't know what to think about it since it's my first finished real code, but hey it works! I'm pretty sure that it can be written ...
user avatar
12 votes
2 answers
941 views

Did not pass the interview about an RPN Calculator

I recently received a simple interview assignment as to implement an RPN calculator in Ruby. The program takes user input and quits when the user presses 'q'. I did it in under 30 minutes and was ...
johnathon's user avatar
  • 121
12 votes
1 answer
46k views

Basic Calculator in Java with Swing

I used a standard calculator design from Java. I wanted to expand it so I created a class to create buttons for different operations, like +, ...
TheWombatGuru's user avatar
12 votes
3 answers
1k views

Simple Calculator Script

I written my own calculator script in javascript! It is a basic one, but works really well. I am just wondering if there is any way to make this script more efficient & clean. On first look, I ...
DanielP533's user avatar
12 votes
1 answer
360 views

Yet Another Java CLI Calculator

In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout: An interface Calculeightor for ...
h.j.k.'s user avatar
  • 19.2k
11 votes
4 answers
15k views

Simple C++ calculator which follows BOMDAS rules

This was my first attempt at making a C++ calculator. The user basically inputs an expression (I'll use \$1+1*(9*(11-1))\$ as an example) and the program searches for and creates a vector for ...
Sky Lightna's user avatar
11 votes
2 answers
340k views

Simple calculator in Java

I've been learning Java for about 3 weeks now, and I was hoping someone could check over my code for me, and let me know how to improve. I am aware that the maths class could be removed (I could've ...
Jim's user avatar
  • 113
11 votes
4 answers
3k views

Calculator with simple input

This is "my" version of a basic C++ calculator, that requires a single line input (like 1+1) to calculate the result. I have been (self)learning the language for 2 months now. I don't pretend to have ...
skorpi7478's user avatar
11 votes
5 answers
3k views

Simple Console Calculator

This is my Java 8 code for a console calculator. I just want to know if it can be improved in any way. Just so you know i am a real beginner just got into java about a couple of weeks ago. ...
user avatar
11 votes
3 answers
1k views

CC C# calculator

This is my basic C# calculator; I'm sure there is much that can be improved. This design is based on Bjarne Stroustrup's C++ calculator, a purposely be-bugged version of which can be found at his ...
user avatar
11 votes
2 answers
2k views

Simple calculator

I created my first program in C: a simple calculator. I want to know if it is possible to make this code more effective. Is it, for example, possible to change the calculator function so that I don't ...
TheWombatGuru's user avatar
11 votes
2 answers
14k views

Binary Calculator in Java

I'm a beginner in Java and I tried to create a program that will perform basic arithmetic operations on binary numbers. BinaryOperations class: ...
Yodism's user avatar
  • 751
11 votes
2 answers
5k views

Calculator with history

I'm the newbie in Java (and programming) and I've tried to make a simple calculator. Code is barbaric, I know, so I would like to make it more beatiful. Main.java: ...
zhanymkanov's user avatar
11 votes
1 answer
4k views

Object-oriented calculator

I have solved an assignment (Exercise 3) from the MOOC Object-Oriented programming with Java, part II, but I'm not enrolled in said course. Assignment Summary: Make a simple calculator. You ...
Grace Mathew's user avatar
10 votes
4 answers
14k views

Simple python calculator

I'm very new to Python, and so I'm trying to learn it by doing simple programs, like a calculator. But I don't know if this is the "Pythonic" way to do it, or if I am making beginner errors. So ...
Rakete1111's user avatar
  • 2,562
10 votes
3 answers
11k views

Basic C# calculator (+,-,*,/)

My 'teacher' requested this problem be solved by parsing the input into a tree based on the order of operations. The class Calc variables are specific to his ...
ehance's user avatar
  • 163
10 votes
5 answers
4k views

Basic calculator program in Python as a beginner [closed]

I'm a beginning coding and this is my very first Python program - a basic calculator. I would very much appreciate any recommendations or fixes! ...
Richard Yudkiss's user avatar
10 votes
6 answers
7k views

Beginner's JavaScript calculator

As a part of a study-group I did a very simple little JavaScript calculator. It's not made to look pretty. Any ideas on how I can make the code prettier? ...
Gemtastic's user avatar
  • 675
10 votes
4 answers
13k views

Basic calculator that takes 2 numbers and does an operation with them

The code works perfectly fine for me (compiled it in BlueJ and Eclipse) but I was wondering what other more experienced programmers thought of it. I'd specifically like to know if it could be shorter ...
Zoratu's user avatar
  • 103
10 votes
4 answers
5k views

Beginner GUI Calculator

I'm very new to Java and programming and I've written a calculator to put all the theory I've learned so far into practice. I'm sure there is a lot of room for improvement since I really just started ...
Maxim's user avatar
  • 452
10 votes
2 answers
3k views

C# Intermediate Calculator Program

I recently created an intermediate calculator program, primarily to practice programming in C# but also for use with my college subjects. Any feedback on coding practices I can implement to optimise ...
Bahkbar's user avatar
  • 103
10 votes
4 answers
7k views

Calculate class to practice encapsulation

I realize this is very beginner code, but I just today grasped the basic concepts of private variables, constructors, and such. I wrote this very simple class, and a class to test it. Any and all ...
Phrancis's user avatar
  • 20.4k
10 votes
2 answers
1k views

Basic python calculator

I have a young friend of mine who is starting to learn Python in school and asked me to give him a little assignment. I am in no way a teacher nor a Python expert, but I accepted. At first I thought ...
L. Faros's user avatar
  • 233
10 votes
4 answers
2k views

Calculating parking fees, given start and end timestamps

Since I have just started Javascript, I am trying to solve a few problems and improve myself. I encountered such a question. I tried to do everything step by step from the question, but I do not think ...
Mustafa Guner's user avatar

1
2 3 4 5
11