/*======== Proforma : EEET-2250 Lab1 Calculator Arithmetic Assignment ============
Avoid losing 10%:
If you are doing the lab test: please rename your file NOW to
lab1_s1234567.cpp
where s1234567 is your student number.
your file nave MUST NEVER contain any spaces. under_score_is_Fine.
If you do not rename your file with student number as specified above: -10% deducted from final mark.
ANNOUNCEMENTS:
DEBUGGING:
System(“Pause”); and cout as way of debugging is a simple and sure fire way that works
in almost any environment. It is a good first step.
However: The Integrated Debugger is a tool that all programmers should be familiar with
and know how to comfortably use.
You might want to start using the Integrated Debugger instead
of the System Pause statement. Using the Debugger means you are not as likely to make the
costly mistake of leaving System Pause in your submitted code.
PURPOSE This file is a proforma for the EEET-2250 Lab1b Calculator Arithmetic
assignment. This file defines the assignment – there is no other documentation.
You the student must extend this program to cope with the
functionality identified below-
BACKGROUND The assignment will be a command line program that reads parameters from the
command line and prints out a well defined result, and nothing
else.
The functionality of this lab is relatively simple: + – / * ^
The emphasis in this lab is on input error detection.
GOAL You will be asked to write a program that takes two numbers from the
command line and performs arithmetic on them as specified by the last parameter.
The program should perform error checking.
SPECIFICATIONS:
Reading specifications is an art. As Engineers you will expected to have the
ability to do this. The specifications for this course are rambling and
discoursive and messy. This is very close to real life specifications in Industry.
In addition the name of the program the command line should take another
three parameters: the first two being numbers the third specifying the
type of operation to be performed.
i.e. correct syntax requires four parameters:
ProgramName Operand1 Operand2 OperationType
The result of the addition should be displayed in the line below the
command prompt.
Example1: lab1b_1234567.exe 10 2 d
which should return 10/2 = 5, i.e. the number 5 on the command line.
When the program is run without any operands i.e. simply “lab1b_1234567.exe”,
the program MUST print student ID string in CSV format, without spaces.
such as: “studentNumber,student_email,student_name”
Penalty for invalid email address: -10%
eg: “s1234567B,s1234567@student.rmit.edu.au,Phantom_Programmer”
NOTE: NO SPACES, ONLY LETTERS, COMMAS, AND UNDERSCORES IN THE ABOVE LINE
(What is the value of argc when no operands are given ?)
ERRORS: The following text lists errors you must detect and a
priority of testing. NB: order of testing is important.
All outputs are a single character followed by a linefeed ( endl or \n).
DO NOT add more than what is specified, do NOT add additional information,
simply and only the output as required.
DO NOT use ‘cin’, do NOT ask for user input. All input MUST be specified
on the command line separated by blank spaces.
All input and output is case sensitive
You should use the Integrated debugging environment: Go to EXECUTE -> PARAMETERS.
In the lab tests the command line window will not be available.
When your code exits the ‘main’ function using the ‘return’ command then
you MUST use zero as the return value. This requirement is for exiting
the ‘main’ function ONLY.
Do NOT put any functions after the main function if you use functions
add them BEFORE the ‘main’ function
ERROR CHECK 1: NUMBER OF PARAMETERS:
NB: the name of the program counts as the first parameter.
If the number of parameters is 1 then the program MUST print student
ID string in CSV format as explained above.
If the number of parameters is 2 the output shall be ‘P’ which
signals a Parameter error
If the number of parameters is 3 the output shall be ‘P’ which
signals a Parameter error
If the number of parameters is 4 the operators shall be further




The idea of homework is that YOU do it. It reinforces a concept or idea covered in class.
At least attempt it yourself, just posting the entire question here expecting us to do it for you shows a complete lack of interest in the subject so why should we waste our time helping you?
The question is obviously too long as it cuts off witha lot more to say. That said the requirements are all there are all contained in the text in a significant amount of detail.
One query, which is probably covered by the missing portion of the text; the example1 given uses the d character to specify division, yet that is not mentioned anywhere, only the standard operators are listed previously + – / * ^
I’d suggest rereading the original specification and at least attempting it yourself and then post specific problems if you get stuck.
PSEUDO CODE – for what can be found in the given text
DEFINE FUNCTION Calculate(input : string op1, input : string op2 , input string op )
..IF ( op1 and op2 are numeric ) THEN
….op1value = value of op1 converted to double
….op2value = value of op2 converted to double
….SWITCH on op
……default : output (error code for unknown operator)
………..+ : output op1value + op2value
………..- : output op1value – op2value
………../ : output op1value / op2value
………..* : output op1value * op2value
………..^ : output op1value to thepower of op2value
….END SWITCH
..ELSE
….output (error code for incorrect values)
..END IF
END FUNCTION
DEFINE MAIN
..declare StudentDetails as string value “what ever you need here”
..SWITCH on Argument Count
….default :- output P
……….1:- output StudentDetails
……….4:- Calculate(Arguements)
..END SWITCH
..result code 0
END FUNCTION
Show your code.
=
We will help make it work.