Welcome to Dream.In.Code
Become a Java Expert!

Join 149,823 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,642 people online right now. Registration is fast and FREE... Join Now!




CALCULATOR

 
Reply to this topicStart new topic

CALCULATOR, square a #, find square root, add memory store and recall, find nth #

rachelray
12 Feb, 2007 - 12:04 PM
Post #1

New D.I.C Head
*

Joined: 5 Feb, 2007
Posts: 2


My Contributions
Someone please help!

I have to write a stand-alone text- based calculator that can perform subtraction, addition, multiplication, and division. In addition, the calculator has to be able to perform the following calculations:

1) Square a number (n*n),
2) Find the square root of a number,
3) Add a memory store,
4) Add a memory recall,
5) Find the nth number in the Fibonacci sequence,
6) Find n factorial,
7) Trap for divide by 0.

So for example, if the user enters:

A 4 5

your program will print:

4+5=9

My program also has to have a help function!

I really hope that someone can help me because that would be great!
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: CALCULATOR
12 Feb, 2007 - 12:43 PM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,351



Thanked: 51 times
Dream Kudos: 25
My Contributions
Hello,

The site has a policy by which we prefer to see a good faith effort on the part of the user before providing source code in the matter of academic assignments. If you could please post the code you have written in an attempt to complete the assignment, our members would be pleased to provide some guidance.

Welcome to dream in code!
User is online!Profile CardPM
+Quote Post

rachelray
RE: CALCULATOR
19 Feb, 2007 - 11:29 AM
Post #3

New D.I.C Head
*

Joined: 5 Feb, 2007
Posts: 2


My Contributions
here is all that i have so far:


import java.io.*;
import java.util.*;

public class Calculator
{
static Scanner console = new Scanner(System.in);

public static void main (String[] args)
{

String sign;
double firstNumber;
double secondNumber;
double answer;
String add;
String subtract;
String multiply;
String divide;
String square;
String squareRoot;

sign = console.nextInt();
firstNumber = console.nextDouble();
secondNumber = console.nextDouble();

input String =
system.out.prinln("What is the firstNumber?"
+ "firstNumber: ");
firstNumber = Integer.parseInt (input String);


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:02AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month