Question: Specifications Build a simple class using the following specifications ArithmeticManager class Variables: operand1, operand 2 (double) Methods: Value return methods that will add, subtract, multiply,

Specifications

Build a simple class using the following specifications

ArithmeticManager class

Variables: operand1, operand 2 (double)

Methods: Value return methods that will add, subtract, multiply, and divide the two operands

Set/get methods for both variables

A parameterized constructor to set the initial operand values as object is constructed

Access the provided graphical user interface at:

http://websites.delta.edu/teklingl/cs1/inpgm2/

however this is incomplete. Once you complete your class, integrate on object of your class into a project that will create a simple application to perform basic arithmetic on two numbers. Your program should include the following behaviors:

As it is launched, initialize your object with the provided basic dialog box prompts

When the user pressed any button, get the values in the respective text fields, set the data in your object, perform the operation, and finally set the result from the method call the answer text field.

// Delta College - CST 183 - In-Class Program 2 // This program allows the user to manage operands and operations // for basic binary arithmetic operations import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ArithmeticGUI extends JFrame implements ActionListener { // Variables JLabel operand1Label, operand2Label, answerLabel; JTextField operand1field, operand2field; JTextField answerField; JButton addButton,subtractButton,multiplyButton,divideButton; public ArithmeticGUI() { // Set up GUI Container appWindow = getContentPane(); appWindow.setLayout ( new FlowLayout() ); // Operand 1 operand1Label = new JLabel( "Operand 1" ); appWindow.add( operand1Label ); operand1field = new JTextField( 4 ); appWindow.add( operand1field ); // Operand 1 operand2Label = new JLabel( "Operand 2" ); appWindow.add( operand2Label ); operand2field = new JTextField( 4 ); appWindow.add( operand2field ); // Arithmetic operations addButton = new JButton( "Add" ); addButton.addActionListener( this ); appWindow.add( addButton ); subtractButton = new JButton( "Subtract" ); subtractButton.addActionListener( this ); appWindow.add( subtractButton ); multiplyButton = new JButton( "Multiply" ); multiplyButton.addActionListener( this ); appWindow.add( multiplyButton ); divideButton = new JButton( "Divide" ); divideButton.addActionListener( this ); appWindow.add( divideButton ); // Handle answer text field answerLabel = new JLabel( "Answer" ); appWindow.add( answerLabel ); answerField = new JTextField( 7 ); answerField.setEditable( false ); appWindow.add( answerField ); // Get initial fraction value String op1String = JOptionPane.showInputDialog( "Enter operand 1" ); String op2String = JOptionPane.showInputDialog( "Enter operand 2" ); // Set application window attributes setTitle( "Arithmetic Manager" ); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); setSize( 800, 300 ); setVisible( true ); } // end constructor // Handle all action events with this method public void actionPerformed( ActionEvent event ) { } // end actionPerformed // Main method public static void main( String args[] ) { ArithmeticGUI application = new ArithmeticGUI(); } // end main } // End class

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!