[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[On Teaching and Learning]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.5 API]
[Espresso]
[TAO of Java]
[CS152 2004F]
[CS152 2005S]
[CS152 2005F]
Assigned: Wednesday, February 8, 2006
Due: 8:00 a.m., Friday, February 10, 2006
Summary: In this assignment, you will write a very simple calculator.
Purpose: To give you an opportunity to explore issues of numbers in strings, particular with regards to input, output, and simple calculation.
Contents:
Write a program that reads a one line arithmetic operation of the form
number operation number
and prints out the result.
You can choose whether to use BigInteger
or
BigDecimal
values.
You can require that there be a space between the numbers and the operand.
Expression: 23 * 13 23 * 13 = 299
You create a BigInteger
from a string with the constructor
which takes a string as a parameter. For example,
BigInteger leftOperand; leftOperand = new BigInteger(exp.substring(0,exp.indexOf(" ")));
When you are satisfied with your work, you should email me the program.
When you ask questions, I'll try to put the answers here.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[On Teaching and Learning]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.5 API]
[Espresso]
[TAO of Java]
[CS152 2004F]
[CS152 2005S]
[CS152 2005F]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 9 08:31:08 2006.
The source to the document was last modified on Wed Feb 8 08:39:39 2006.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2006S/Homework/hw.05.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby