Write all of the strings from the arraylist to that file

Assignment Help JAVA Programming
Reference no: EM131587179

Assignment

This week we will write modify the memory calculator from Assignment 9 to be able to save all of the calculations done to a file. There are multiple ways to do this, but I suggest creating an ArrayList of String objects. Each time the user performs an operation (add, subtract, multiply, divide, or clear), add a new String. For instance, if the current value is 6 and the user chooses to add 2, you would create a new String "6 + 2 = 8" and add that String to the ArrayList. You will also need to add a new "Save" item to the menu. When the user chooses this option, you should call a method that displays a JFileChooser dialog to the user, allow them to select where to save the data, and then write all of the strings from the ArrayList to that file. Be sure to handle exceptions gracefully.

Sample output:
The current value is 0.0

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 1 What is the second number? 5 The current value is 5.0

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 2 What is the second number? 3 The current value is 2.0

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 3 What is the second number? 5 The current value is 10.0

Menu

1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 4 What is the second number? 0 The current value is NaN

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 5 The current value is 0.0

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 6 The current value is 0.0

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Clear
6. Save
7. Quit

What would you like to do? 7 Goodbye!

The data in the file should look like this:

Initial value is 0 0.0 + 5.0 = 5.0
5.0 - 3.0 = 2.0
2.0 * 5.0 = 10.0
10.0 / 0.0 = NaN Cleared

You will be graded according to the following rubric:

- A save option has been added to the menu.
- The save option calls a method that displays a JFileChooser dialog and allows the user to select a file.
- The save method writes to the selected file.
- The information written to the selected file is correct.
- Exceptions are handled gracefully (i.e. nice error messages are displayed to the user rather than the stack trace).
- Your program compiles
- Your program runs
- You follow standard coding conventions (e.g variable names, indentation, comments, etc)

Attachment:- memoryCalculator.zip

Reference no: EM131587179

Questions Cloud

How many people bought only apple turnovers : A pastry shop opens across the street from Haddad Library, and of course, it is very popular. The very first day, 80 people buy apple turnovers.
Explain where the organization excels in design thinking : Explain where the organization excels in design thinking. Make recommendations that the organization can undertake to improve design thinking and innovation.
Define astronomers and their discoveries : the greatest physicists or astronomers and their discoveries. Choose one of the Scientists
How many different programs to do a single task : How many different programs to do a single task can you write if there are six available algorithms for the task and each has been coded in four different ways?
Write all of the strings from the arraylist to that file : Write all of the strings from the ArrayList to that file. Be sure to handle exceptions gracefully -allow them to select where to save the data
Quantity of dish washers bought and sold at equilibrium : Where P is the price of dish washers, what is the quantity of dish washers bought and sold at equilibrium?
Write an essay about best ethical company you recognize : Write an essay about best ethical individual or company you recognize, and at least three pages on the worst ethical individual or company you recognize.
What specific types of mental health disorders are encounter : What specific types of mental health disorders are encountered in a criminal justice setting?
Country from a financial perspective : Discuss why now would or would not be a good time to travel to this country from a financial perspective.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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