Question: Part - 1 : Write java program for this question in this question in addition to main class you should create two classes : addsubtract

 Part - 1 : Write java program for this question in

Part - 1 :

Write java program for this question in this question in addition to main class you should create two classes : addsubtract and multiplyDivide and make sure the program should work in any conditions there may be space or no space between " a " and a valid arthmetic operation and also similarly between the valid arthmetic operation and " b " Examples also given in the question .

Read the question carefully and do it correctly this question contains 65 marks.

this question in addition to main class you should create two classes

part - 2 :

Write java program for the part - 2 question classes and rest of the discription is same as the part - 1

Read the question carefully and do it correctly this part - 2 contines 35 marks.

Special note :

**** Write seperate programs for part - 1 and part - 2

Part 1 (65 Marks): The first part of the program reads an arithmetic operation when the user keys in one of the following forms: a+b; a - b; a *b; a/b where a and b can be either positive or negative integers. There may be spaces or no space between a and a valid arithmetic operation and also similarly between the valid arithmetic operation and b. Some valid examples are given below: a+b, a +-b, a+-b, a +-b, a+-b -a +b, -a +-b, -a+-b, -a +-b, -a+b a-b, a- --b, a--b, a--b, a--b -a-b, -a - --b, -a--b, -a --b, -a--b a*b, a*-b, a*-b, a *-b, a*-b -a *b, -a*-b, -a*-b, -a *-b, -a*-b a/b, a/-b, a/-b, a /-b, a/-b -a / b, -a/-b, -a/-b, -a /-b, -a/-b Your program should detect any non valid arithmetic operations by informing the user "it's an invalid arithmetic operator" and prompting the user to retry. A maximum of three tries are given to the user and the program terminates when the user exceeds the number of tries. In addition to the main class create two classes in this program: addSubtract and multiplyDivide. In the main class, the program reads the user entry and first determines if the entry is valid. Next, it determines the integers a and b and also the sign of the operation. Based on the sign, they are then passed on to one of the classes. In both addSubtract and multiply Divide classes the arithmetic operations are carried out and also the result of the operation is printed. In the multiplyDivide class, the output is in a Double format. An important function in the developed program solution is testing. Your program should test for all possible valid data entries and invalid ones too. Some of the valid ones are given below Replace a and b with any values not exceeding 1000. a + b, a +-b, a+ -b, a +-b, a+b -a + b, -a +-b, -a+ -b, -a +-b, -at-b a-b, a--b, a--b, a--b, a--b -a-b, -a --, ---, -a --b, -a--b a*b, a*-b, a*-b, a *-b, a*-b -a*b,-a *-b, -a*-b, -a *-b, -a*-b a/b, a/-b, a/-b, a /-b, a/-b -a/b, -a/-b, -a/-b, -a /-b, -a/-b In submitting your solution show proof, your program worked for all valid and invalid case cases. Part 2 (35 Marks) This program reads two valid arithmetic operations. Assume the arithmetic operation sign for the purposes of the description to be of & (+,-*,7). They can be in the form of: a & b&c. Some examples are a+b+c a-b*c, a/b*c, a*-b /c -a--b*c The classes and the rest of the description is exactly the same as in Part 1. The following marks will be awarded for the correctness of the program (20 Marks) and testing with proof (15 marks). Part 1 (65 Marks): The first part of the program reads an arithmetic operation when the user keys in one of the following forms: a+b; a - b; a *b; a/b where a and b can be either positive or negative integers. There may be spaces or no space between a and a valid arithmetic operation and also similarly between the valid arithmetic operation and b. Some valid examples are given below: a+b, a +-b, a+-b, a +-b, a+-b -a +b, -a +-b, -a+-b, -a +-b, -a+b a-b, a- --b, a--b, a--b, a--b -a-b, -a - --b, -a--b, -a --b, -a--b a*b, a*-b, a*-b, a *-b, a*-b -a *b, -a*-b, -a*-b, -a *-b, -a*-b a/b, a/-b, a/-b, a /-b, a/-b -a / b, -a/-b, -a/-b, -a /-b, -a/-b Your program should detect any non valid arithmetic operations by informing the user "it's an invalid arithmetic operator" and prompting the user to retry. A maximum of three tries are given to the user and the program terminates when the user exceeds the number of tries. In addition to the main class create two classes in this program: addSubtract and multiplyDivide. In the main class, the program reads the user entry and first determines if the entry is valid. Next, it determines the integers a and b and also the sign of the operation. Based on the sign, they are then passed on to one of the classes. In both addSubtract and multiply Divide classes the arithmetic operations are carried out and also the result of the operation is printed. In the multiplyDivide class, the output is in a Double format. An important function in the developed program solution is testing. Your program should test for all possible valid data entries and invalid ones too. Some of the valid ones are given below Replace a and b with any values not exceeding 1000. a + b, a +-b, a+ -b, a +-b, a+b -a + b, -a +-b, -a+ -b, -a +-b, -at-b a-b, a--b, a--b, a--b, a--b -a-b, -a --, ---, -a --b, -a--b a*b, a*-b, a*-b, a *-b, a*-b -a*b,-a *-b, -a*-b, -a *-b, -a*-b a/b, a/-b, a/-b, a /-b, a/-b -a/b, -a/-b, -a/-b, -a /-b, -a/-b In submitting your solution show proof, your program worked for all valid and invalid case cases. Part 2 (35 Marks) This program reads two valid arithmetic operations. Assume the arithmetic operation sign for the purposes of the description to be of & (+,-*,7). They can be in the form of: a & b&c. Some examples are a+b+c a-b*c, a/b*c, a*-b /c -a--b*c The classes and the rest of the description is exactly the same as in Part 1. The following marks will be awarded for the correctness of the program (20 Marks) and testing with proof (15 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!