31927 - applications development with net - prepare a c


ASSIGNMENT SPECIFICATION

This assignment is split into two documents.
1. Assignment Specification. This document contains the specification for what you will be required to do.
2. Assignment Addendum. This document contains all other details regarding the assignment, including assignment submission and the assessment scheme.

Requirement

In this assignment you are to prepare a C# program that will act as a simple equation solver. The equation solver will be run from the command line and will only work with integer numbers, a single variable (X) and the following arithmetic operators: + - * /.

For example, if the C# program is compiled to Equ.exe, the following demonstrates how it will appear in the command line:


calc 3X + 5 = 8
X = 1

In the command line, the argument is entered as the "calc" keyword followed by a space and followed by a sequence of numbers, variables, and operators, such as: calc
Hitting the enter key will cause the program to evaluate the arguments and print the result as one or more numbers separated by ",":

X=.

The console should remain open and allow the user to continue to enter equations to be solved.

The program must follow the math rules of solving equations with 1 variable type (i.e. linear and quadric style equations). For example:
2X - 1 = 0
3X + 8X = 33
4X - 7 = 8X - 5
X / (x+12) = 1 / 13

The program must follow the usual laws of arithmetic which says:
1. The * / and % operators must all be evaluated before the + and - operators.
2. Operators must be evaluated from left to right. For example, using Rule 1

X = 2 + 4 * 3 - 6
Becomes
X = 2 + 12 - 6
Which results in X = 8

If we did not use Rule 1 then 2+4*3-6 would become 6*3-6 and then 18-6 and finally 12. This is an incorrect result.
If we do not use Rule 2 then the following illustrates how it can go wrong 4*5%2
Going from left to right we evaluate the * first, which reduces the expression to 20%2 which becomes 0. If we evaluated the % first then the expression would reduce to 4*1 which becomes 1. This is an incorrect result. Remember, we are using integer mathematics when doing our calculations, so we get integer results when doing division. For example:

calc X = 20 / 4
X = 5
Also note that we can use the unary + and - operators. For example: calc X = -5 / +2
X = -2

Your program must also check to make sure the command line argument is correct and handle the equation parts. If not your program must generate an appropriate error message and then terminate. For example:

calc X = - 3 + 4 / 6 (spaces represent splitters between numbers and operators)
Becomes X = -3 + 4 / 6

calc X = 3 + 4 / 6 + (space after+) Becomes X = 3 + 4 / 6 + 0 (replace by 0)
Becomes X = 3 + 4 / 6

calc X = 3 + + + 4 - 6 (operation elimination)

Becomes X = 3 + 4 - 6

calc X = 3 - - - 8X - 4
Becomes X = 3 - 8X - 4

calc X + 3 + 6 + 3333333333333
Invalid Input (this is not equation and invalid as well)

calc X^2 = 2121212121 + 2020202020
Out of Integer Range

calc X = 4 / 0 Division by zero

Program Hints

1. Getting your program to solve expressions that only use the + and - operators is fairly easy. I would suggest you get your program working at this level before attempting to get it to work with the other operators.

2. You will find this problem much easier to solve if you application has a good design concept; create a generic input that takes all parameters and operations and break it down into smaller methods responsible for validations, aggregations and calculations. For example, enumerate the possible operations and then have a method that solves (number operator number). Also have a method that gets the number from a string and another that gets the operator from a string. Also note that splitting your code up will give you a better design mark.

Assignment Objectives

The purpose of this assignment is to demonstrate competence in the following skills.

- Problem solution
- Employ basic mathematic skills to develop C# program
- Program design
- Array and string manipulation
- Command line arguments
- Creating Object Oriented methods in C# These tasks reflect all the subject objectives.

The solution of this assignment will take between 200 and 300 lines of code, including white space (blank lines) comments, etc. The exact number will depend on how the students solve the task. As part of your subject workload assessment, it is estimated this assignment will take more than 30 hours to complete.

Assessment

- Functionality
Your code will be run against 16 test cases. These test cases are distributed as stated in the marking table below. For 100%, your program should pass all test cases in all four marking tiers in the table below, as well as well satisfying the Design and Coding Style sections below.

Only equations that maintain whole integer values throughout calculations will be tested during marking. E.g. "X = 5 / 2" will not be tested.

The C# project must unzip successfully and compile without errors. Marks will be deducted for compile and runtime errors.

- Design:
Marks will be awarded on the quality of your code design and the algorithms used. This includes splitting your code up into well designed classes and methods as bellow:

- Functional separation: Is the problem broken down into meaningful parts and reusable methods?
- Loose coupling: Can parts be changed in isolation of each other?
- Extensibility: Would it be easy to add more functionality? (more operations, more numerical accuracy, interactivity, variables, etc)
- Control flow: Are all actions of the same type handled at the same level?
- Error handling: Are errors detected at appropriate places? Can they be collected somewhere central?

- Coding Style
- 1 mark for consistent indentation, whitespace, and braces.
- 1 mark for appropriate and clear code comments.
- 1 mark for clear class, method, and variable naming

Attachment:- Assignment_Addendum.rar

Request for Solution File

Ask an Expert for Answer!!
DOT NET Programming: 31927 - applications development with net - prepare a c
Reference No:- TGS02909512

Expected delivery within 24 Hours