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..
Unix shell and history problem, UNIX Shell and History feature. 1.Creating ...
UNIX Shell and History feature. 1.Creating a child process. 2.Creating a history feature. Its exactly "programming project 1 - Unix Shell and History Feature (p.157-159)" in the Si
Operating system problems, 1. In discussing software algorithms for mutual ...
1. In discussing software algorithms for mutual exclusion, we noted that optimizing compilers and out-of-order execution by processors could invalidate most of these algorithms bec
Computer, identify application software from the list? ms excel linux inter...
identify application software from the list? ms excel linux internet explorer adobe photshop sound card driver window disk manger adobe dream weaver windows file explorer
Computer architecture, speed up factor for superscalar architecture
speed up factor for superscalar architecture
Read world population data file. store the values in multipl, Read World Po...
Read World Population Data File. Store the values in multiple vectors. Sort them by most populated region and output the results ext file is here : please">http://www.csupomona.
Computers in laboratory organisation and management, Computers can be used ...
Computers can be used for better and more efficient management and organisation of laboratories. A computer like the human brain receives information, stores and processes it and t
What is i-node number, Question 1 Bring out the advantages of Linux Ope...
Question 1 Bring out the advantages of Linux Operating systems Question 2 Match the Symbols with their respective file types Symbol File N
Write a schema for the operation of ending a game, QUESTION 1 We need ...
QUESTION 1 We need to write Z specifications to record the information about passengers on board an aircraft. Here you are required to produce the specifications using appropr
Need of artificial intelligence, Need of artificial intelligence: Artif...
Need of artificial intelligence: Artificial Intelligence may be seen as just the latest tool in the philosopher's toolbox for answering these all questions about the behavior o
Java program, To find the minimum number of shelves in the loading process ...
To find the minimum number of shelves in the loading process in cars
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
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Terms & Conditions
Copyright by ExpertsMind IT Educational Pvt. Ltd.