# Calculator

• 5
• Locked
The calculator is like a rite-of-passage in programming. Every decent noob simply must write a program that adds and subtracts. Now that we already know how to manipulate classes and static methods, we'll create a regular calculator with four arithmetic operations and even the ability to find a percentage of a number!
You can't complete this task, because you're not signed in.
Naughtless
Level 41 , Olympus Mons, Mars
7 May 2021, 14:30
Okay, the requirement checking on this one is really bad. Why do I have to convert integers a and b to double using (double)? Why is it an issue if I just change the input parameter datatype to double? Again, this course has been fantastic thus far with the lessons and what not, but this one specifically is TERRIBAD.
Libby
Level 20 , United Kingdom
5 January 2021, 12:24
Is the third requirement not a/b? Why is it not working?
Maryem Vickers
Level 7 , HT..., United Kingdom
7 October 2020, 18:33
Hey! I have found out how to solve the Calculator task simply! Here's should will help you so much!; (This is a new concept. Keep that in mind. :).). For the multiply and divide problems, use this to help you; double k = (double)b / c; Do you get it now?! :>. I hope you do understand!
Brandon Leirer
Level 7 , Keller, United States
12 June 2020, 21:13
writing (double)a and (double)b does the trick too.
Maryem Vickers
Level 7 , HT..., United Kingdom
7 October 2020, 18:33
I was going to say that...
Nastya
Level 19 , Moscow, Russia
7 May 2020, 17:24
(a / 100.0) * b
Nickolas Johnson
Level 8 , St. Louis, United States of America
13 March 2020, 20:07
Double.valueOf(a) you're my only friend.
Maryem Vickers
Level 7 , HT..., United Kingdom
7 October 2020, 18:37
(double)k is too.
Jackir Miah
Level 9 , London
25 January 2020, 14:57
The last method has int as arguments but returns a double. Sneaky casting had me stumped.
Tonatiuh
Level 12 , Mexico, Mexico
23 October 2019, 00:52
Note that in the division and percent methods you need to convert them into double numbers. You can add a double in parenthesis next to at least one number. For example: If a is an integer, then (double)a/3 gives you a double number. And if you want the x percent of the y number. First you need to divide x/100 and then multiply it by y.
Almano Y'alano
Level 7 , London, United Kingdom
12 February 2019, 17:47
Done!
Almano Y'alano
Level 7 , London, United Kingdom
12 February 2019, 14:45
The method percent returns a double but b is an int and you want the method to return b, how's that possible? Would you like us to cast b as a double ?