Program that will act as a simple equation solver

Assignment Help DOT NET Programming
Reference no: EM132116058

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 <Equation formula>
Hitting the enter key will cause the program to evaluate the arguments and print the result as one or more numbers separated by ",":

X=<result>.

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

Reference no: EM132116058

Questions Cloud

How many students have grades below 80 : In a large class of 3000 students, the mean and standard deviation of a final exam are 70 and 10, respectively:
Do you think that business use of the internet has changed : How should a business store, access, and distribute data and information about its internal operations and external environment? Explain.
Power point about lean sychronization : Prepare power point about lean sychronization
Explain why to implement a queue using a linked list : Explain why, to implement a queue using a linked list, it is recommended to extract nodes from the top of the list and insert nodes at the tail of the list.
Program that will act as a simple equation solver : 31927 - Applications Development with .NET - prepare a C# program that will act as a simple equation solver. The equation solver will be run from the command
Define the basic purpose of ip precedence : Explain the purpose of QoS on a TCP/IP network. Define the basic purpose of IP Precedence, TOS, Diffserv, and ECN functionality.
Developmental psychologist hypothesized : A developmental psychologist hypothesized that children who are reared in families where more than one language is spoken will have higher abstract reasoning
The best function prototype for the given function : Assume a program contains a void function named calcNewPrice(). The function receives two double variables named oldPrice and newPrice.
What proportion of boxes is underweight : Q1: What proportion of boxes is underweight? Q2: How heavy does a box have to be in order for the box to be labeled overweight?

Reviews

Write a Review

DOT NET Programming Questions & Answers

  Develop web services based application

Develop and test a Web services based application that meets the requirements applying SOA design principles.

  Design style elements in asp

Add drop down lists for modifying the different style elements for the label element that displays the time

  Create a shopping cart in asp

The users will use a browser to access the on-line store. The web server software for the production web server is Windows 2003 Server /IIS6.

  Inventory management system in c# application

Inventory management system in c# application

  Using .net resources to teach .net

This project will use the .NET framework to produce a set of materials to demonstrate the fundamental principles of .NET. Ideally it should demonstrate some of the principles of the framework e.g. interoperability.

  Prepare a marymount faculty site

Prepare a Marymount faculty site

  Blinky lights

Analysis proving that your code blinks the LEDs at the specified rates.

  Prepare a web application

Prepare a web application that will be used to keep track of patients registering in a hospital.

  Implementing the insurance management system

Implementing the Insurance Management System and implementation of Components as Web Services.

  Describe the characteristics of visual studio 2005

Describe the characteristics of Visual Studio 2005 Visual Studio.Net is a suite of products that includes 4 main languages. Name these languages and outline their use in industries

  What is a connectionstring

What is a ConnectionString. Give a suitable example to illustrate the various part of a ConnectionString

  Prepare a web application for internet service provider

Prepare a Web application and write the code also event planning document base. This web application allows the user to sign up for an Internet service provider for home connectivity.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd