buzzlightyear79 0 Newbie Poster

this program is challenging any ideas

program should read the commands in sequential order, process
them, perform the necessary calculations, and then print out the
results in a neat, readable manner, both to a file and to the screen.
Details
The first line of the file contains two characters giving the initials of the
user (such as GN). The rest of the file consists of a sequence of
commands. Each line of the command file contains one command.
Each command starts with a character and may have zero or more
operands. You may assume that the data file has no errors. The
number of commands in the file is unknown. But your processing may
stop as soon as the Quit command is processed. The commands are:
integer add, integer subtract, integer multiply, integer divide, change
to uppercase, change to lowercase, separate, print out all digits, print
out the k-th digit, round real number to desired number of decimal
places, divide number into two.
Calculator Commands
+ i j [Integer Add]
Add integers i and j and print out result
* i j [Integer Multiply]
Multiply integers i and j and print out result
- i j [Integer Subtract ]
Subtract integer j from i and print out result
/ i j [Integer Divide ]
Divide integer i by j and print out result of integer
division
C Ch [Character Case Change ]
Change character Ch to uppercase and print it out
c Ch [Character Case Change]
Change character Ch to lowercase and print it out
P i k [Print k-th Digit ]
Print out the k-th digit of integer i
R x i [Round Reals ]
Round double value x to i signi cant decimal places
S x [Separate ]
Separate out the sign, integer part and fractional
part of double value x
D i x [Partition Integer ]
Given integers i and x, print out two integers j and k,
where the sum of j and k equals i, and when you take x%
of i and truncate it you get j
H [Help ]
Print a short synopsis of all the available commands
Q [Quit ]
Quit
Additional Notes:
For Project 1, you will only have to implement commands: +, -, *, /,
H, Q. For Project 2, you will need to implement the rest.
There is always a space between the command character and the
operands (if any). For the division operation, the second operand will
never be a 0. For the operation that changes to uppercase, you will
always be given a character that is a lowercase letter of the alphabet
(never an uppercase letter of the alphabet, a digit, a punctuation, or a
special character). For the operation involving rounding a double value
to the right decimal point, the output may have trailing 0's to pad it at
the end. So the output for command \R 3.567 1" may be 3.6000. You
will not be asked to round a negative number.
Print out a short synopsis of all the commands at the start of the
program in order to guide the user. Make sure that your output echoes
the commands you read in from the file and provides the output in a
readable format. Make sure you separate the output of one command
from the next. Start with 2 basic operators (Add and Quit), prepare a
file with just these 2 commands and get your program tested and
working for it. Then move on to other commands, one by one. If you
have not gotten one of the commands to work, then make a dummy
function that simply prints out a message saying “Function Z not
implemented yet!”

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.