StringCalculator need ASAP!!

Cancelled

Description

NEED THIS DONE IN 2 HOURS (1AM EST, MIDNIGHT CENTRAL). 40$

Introduction

Many programs have to manipulate String objects in interesting ways. The String class is also

well designed and provides many useful methods. So, this assignment will give you some

practice with it.

You will write a simple calculator program that only performs addition and subtraction.

Addition/Subtraction calculator

Your program will compute numeric values based on what the user enters in a single line of text.

Here are some example lines:

-5 + 6 - 2 ; 2 – 4– 8; 16 +-18 - -1;

This line contains two calculator expressions. The first has the value -1 and the second’s value is

-10 and the third’s is -1

Requirements

• Your program must read a single line of text that contains a series of addition/subtraction

expressions. Each expressions will be terminated by a semicolon (except when there is

an error). If the last expression does not end with a semicolon, that is an error.

• The numbers should be only integers. They may have a leading minus sign to indicate a

negative value. The minus sign should not be separated from the first digit of the integer.

• There is no restriction on the number of spaces between any two symbols.

• Your program must give error messages in the following cases:

o A missing semi-colon on the last expression

o The use of any operator other than + or -

o Any deviation from the pattern of “number plus/minus number plus/minus …”

• Don’t worry about giving error messages that recognize complex errors. For example,

you don’t have to report that there are two plusses in a row. Just complain that you

expected a number, but saw an operator.

• Once you see an error, you can stop trying to parse the rest of the expression.

Suggestions

• Our solution uses all of the following methods. There are alternate solutions that might

use a different mix, but for us, this was the easiest path

o From the String class: charAt, substring, trim, split, and indexOf

o From the Character class: isDigit, and isLetter

• Your life will be better if you don’t try to put everything in the main method. You might

consider having a method like this:

o public static double parseCalculatorExpression(String decl)

This method is called by main() and handles a single calculator expression. It

assumes that its argument has had the semicolon removed and then been trimmed

Sample Output

We’ll provide sample output later

Welcome to the Expression Calculator

Enter a line of expressions:

-5 + 6 - 2 ; 2 - 4- 8; 16 +-18 - -1; 1 --2;

Expression 1: value = -1

Expression 2: value = -10

Expression 3: value = -1

Expression 4: value = 3

Goodbye!

Welcome to the Expression Calculator

Enter a line of expressions:

---; 5 * 4 ; 6 + 15.7; - 6 ; 10 + ; ; 7

Expression 1: ERROR: “-“ is not a valid integer

Expression 2: ERROR: * is not a valid operator

Expression 3: ERROR: “.” is not a valid operator

Expression 4: ERROR: “-“ is not a valid integer

Expression 5: ERROR: expression did not end with an integer

Expression 6: ERROR: empty expression

Expression 6: value = 7

ERROR: final expression not terminated with a semicolon

Goodbye!

Skills: Java

See more: assignment, what need for an operator, what is substring, substring in c, substring c, substring 0 2, string pattern, string c plus plus, pattern string, method to write a report, integers and, first class solutions, first class objects in java, final trim, est java, c substring, c string substring, c string pattern, c# programs with output, c plus plus string, c# example programs with output, assignment method example, asap it solutions, 16 handles, Trim

Project ID: #2516606

10 freelancers are bidding on average $48 for this job

dobreiiita

Hello, I am expert and dedicated in JAVA Development.I am very much interested for your project. I can complete your project quickly and efficiently in time. Details will be discussed in the message. I will be able to More

$50 USD in 0 days
(244 Reviews)
6.9
monojitasish

Hi, Please let me do it.

$150 USD in 2 days
(3 Reviews)
3.8
gojkid

This is a very simple java project for me...Can do this for you within a day....

$30 USD in 1 day
(10 Reviews)
3.5
LahiruMal

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Let's begin just now........... $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ More

$30 USD in 0 days
(2 Reviews)
1.2
kartheeks

Hi rdsoto, We will deliver a quality product in time, please let us do this for you. Thank you, Kartheek

$30 USD in 0 days
(0 Reviews)
0.0
alvinMe

I can do that...

$30 USD in 1 day
(0 Reviews)
0.0
rahul4aug

I can deliver good quality solution in no time

$30 USD in 0 days
(0 Reviews)
0.0
corneliugosa

Hello, I can develop your application in less then 2 hours for 30$. Please see my resume for details on my skills and experience collected. I'm looking forward to hearing from you. Best wishes, Cornel

$30 USD in 1 day
(0 Reviews)
0.0
Darshanlila

Sir, We are group of IT Graduates really excelled in our area.Java is at prime in our area of interests.Working with us would really give you best quality of work with optimum satisfaction.Really looking forward of he More

$50 USD in 2 days
(0 Reviews)
0.0
biswasm

Already done a similar assignment, ready to start now. Thanks.

$50 USD in 2 days
(0 Reviews)
0.0