Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a java program that analyzes a text file and performs simple math operations, for each line of the file. The program should catch exceptions

Write a java program that analyzes a text file and performs simple math operations, for each line of
the file. The program should catch exceptions when the action cannot be executed, it should display
an appropriate message, and move to the next line.
Operations are limited to addition/subtraction, division/multiplication (up to two operations),
and a single parenthesis. Define your own exceptions, including the following exemplary situations:
1+(2*3=
syntax error: ')' expected
1+(2*3)
5+12/0=
5+a=
5/1000000000000000000000=
c^{g~[\pm Z
syntax error: = expected
Zero Division Error
runtime error: a undefined
integer limit (>32-bit required)
illegal characters
If the text file is missing/cannot be opened, the program should display an appropriate message.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions