Customer Service Chat
Get quote & make Payment
Linux Calculator in Java, Basic Computer Science
Could you create a linux calculator using very basic java code (not complex, because I am a novice java coder). It should be called into the terminal for interaction.
Here is the assignment:
I have a problem performing simple arithmetic operations. I need it to
perform addition, subtraction, multiplication, division, and exponentiation.
The program should read operations from standard input and/or from a file. If it reads from a file then the file will contain all of the operations and data. If the program reads from standard input then the program is interactive. It should be able to do both.
The program is to be called xcalc. It is to be run from the UNIX command line prompt. A sample execution is below.
$calc file l file 2
$calc < file 1
It will read from the standard input and write to the standard output with the capability of i/o redirection. I also want the program to have the command line option capability to specify an output file
Scale -O outputfilename inputfilenamel
The numbers read are to be unsigned integers and the operations are to be in prefix form. The operations are addition, subtraction, multiplication, division, and exponentiation.
The control d character (the UNIX end of file character) will end the program if it is interactive. The following sample list of operations should help clear up any confusion.
"e 2 3"
The operation must be the very first character on the input line followed by 1 or more blanks. Any number of blanks can be before or after each operand. No blanks can be embedded into a number. Sample execution and operation follows that illustrate interactive mode
>>+ 11 22
>>11 + 22 =33
>>22 * 2 = 44
There is one arithmetic operation that can be used to implement all others. Determine which one and use it to implement all of the operations: "+, -, *, /, and e." If you cannot determine which operation is the "one magical all powerful operation" then try using addition "+".
You should check for invalid operations and for division by zero.
This program is to be developed using the principles discussed in class
Each operation should be implemented as a function. See the example below.
int add (int augend, int addend)
sum = augend + addend;
If you cannot figure out how to use addition "+" then use the : "+, -, *, /, and e." in a straight forward manner.
int multiply (int multiplicand, int multiplier)
product = multiplicand * multiplier;
Posted Date: 4/11/2012 8:22:03 PM | Location : United States
Ask an Expert
Linux Calculator in Java, Assignment Help, Ask Question on Linux Calculator in Java, Get Answer, Expert's Help, Linux Calculator in Java Discussions
Write discussion on Linux Calculator in Java
Your posts are moderated
Write your message here..
Algorithms and psuedocodes, write an algorithm and psuedo code for the oper...
write an algorithm and psuedo code for the operation of the cramer`s rule
Utility , what are the definition?
what are the definition?
Probability, Mike sells on the average 15 newspapers per week (Monday – Fri...
Mike sells on the average 15 newspapers per week (Monday – Friday). Find the probability that 2.1 In a given week he will sell all the newspapers  2.2 In a given day he will sel
Internetworking, You have been approached by Company XYZ to design and depl...
You have been approached by Company XYZ to design and deploy a new network that will span three cities in Queensland: Brisbane (12 users), Gold Coast (8 users), and Cairns (6 users
Search problems in artificial intelligence, Specifying Search Problems ...
Specifying Search Problems In our agent terms, a problem to be solved is a particular task where the agent starts with the environment in a given state and acts upon the enviro
What is vpn? list the different types of vpn, Question 1 What is routing? ...
Question 1 What is routing? Explain the principles of routing Question 2 Explain different types of server operations in Enterprise Networking Question 3 Briefly d
Configuration of a pc, Configuration of a PC: Generally, when you thin...
Configuration of a PC: Generally, when you think of purchasing a Computer, you first try to exactly know what will be the hardware components such as processor, memory etc. of
Networks, Networks: There are different interpretations for the term °...
Networks: There are different interpretations for the term °nets% The Oxford English Dictionary states that 'a network is an interconnected chain or system of immaterial thing
Pyhon''s Multi-Line Statements , Statements in Python classically end with ...
Statements in Python classically end with a new line. Python does, though, permit the use of the line continuation character (\) to denote that the line should continue. Illustrati
Data movement instruction, Example of register Assignment & R/M Assignment
Example of register Assignment & R/M Assignment
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
IT Courses and Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Follow Us |
T & C
Copyright by ExpertsMind IT Educational Pvt. Ltd.