Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create code in NetBeans java gui jframe form: Program Requirements: Create a program that has the ability to store and display integer values in an

Create code in NetBeans java gui jframe form: 

Program Requirements:

Create a program that has the ability to store and display integer values in an array. Create an array that is 20 elements long. Your program must be able to:

  • Add numbers (only positive) to the array using screen input.
  • Remove the first occurrence number from the array based on screen input.
  • List all of the elements in the array and compute the sum of all the elements.
  • List the even elements in the array and compute the sum of the even elements.
  • List the odd elements in the array and compute the sum of the odd elements.
    Tips:
  • Arrays are immutable, meaning that you can't actually delete an element from an array. So when you remove an element from an array it means that you are setting it back to zero. As such, for this program, the user should only be allowed to enter positive numbers.
  • This array is 20 elements long. Meaning that the user cannot add more than 20 numbers. Ensure that your program is coded in a way that gives the users feedback when they have reached the maximum and ensure that your program never crashes due to an attempt to access an index of the array that does not exist.
  • Even integers can be determined by dividing each number by two.
    • If the remainder is 0, the number must be even.
    • If there is a remainder, the number must be odd.

Sample Application Output:

Screen Shot 2023-08-02 at 10.37.25 PM.png 

List Screen Basic Application Example File Help Integer Sums Enter an Integer: 34 Add 2 3 Sum All 7 9 Sum Even 34 Sum Odd List Sum All Screen Basic Application Example File Help Integer Sums Remove Enter an Integer: 5 Add Remove 2 List 3 Exit 7 Sum All Exit 9 34 Sum Even The total of the entries is: 55 Sum Odd

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import javaawteventActionEvent import javaawteventActionListener import javaxswing public class ArrayOperations extends javaxswingJFrame private final int numberArray new int20 private int currentInde... 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

Step: 3

blur-text-image

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

Java Programming

Authors: Joyce Farrell

10th Edition

0357673425, 9780357673423

More Books

Students also viewed these Programming questions