Now extend your program to give the user the option to either enter two numbers and an operator, like before, or to read all of the equations from a new txt file (the user should add the name of the txt file as an input) and print out all of the equations together with the results. Use defensive programming to ensure that the program does not crash if the file does not exist and that the user is prompted again to enter the name of the file.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

● Create a simple calculator application that asks a user to enter two
numbers and the operation (e.g. +, -, x, etc.) that they’d like to perform on
the numbers. Display the answer to the equation. Every equation entered
by the user should be written to a text file. Use defensive programming to
write this program in a manner that is robust and handles unexpected
events and user inputs.

Now extend your program to give the user the option to either enter two
numbers and an operator, like before, or to read all of the equations from
a new txt file (the user should add the name of the txt file as an input) and
print out all of the equations together with the results. Use defensive
programming to ensure that the program does not crash if the file does
not exist and that the user is prompted again to enter the name of the file.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage