: this is what i nees to do:
:
: Write a text menu-based program to allow a user to continually
: select from the following options:
: a. Store up to a maximum of 20 integers in an array. Enter numbers
: until the sentinel value -
: 99 is entered. Be sure to warn the user if they attempt to enter too
: many numbers. [2 marks]
: b. Print out all the values in the array. [1 mark]
: c. Search for a specified number in the array. If the number is
: found, print, “The number
: <insert number> is found”, otherwise print, “The number <insert
: number> is not found”. [2
: marks]
: d. Remove a number from the array. If the number is found, print,
: “The number <insert
: number> has been removed” and move elements to get rid of the
: “space” in the array. Print
: out an appropriate message if the number is not found. [3 marks]
: e. Set all cells in the array to contain the same user-specified
: number. [1 mark]
: f. Calculate the average of the numbers in the array. [1 mark]
: g. Quit the program. [hurdle]
:
:
: import java.util.*;
:
: public class numbers
: {
: /****************************************************************/
: public static void main(String args[])
: {
: // instance variables - replace the example below with your own
: int[] numbers ;
: char choice;
:
:
: /**
: * Constructor for objects of class numbers
: */
:
: // initialise instance variables
: Scanner scan = new Scanner(System.in);
: numbers = new int [20];
:
:
: System.out.println("---------------------------------MENU----------------------------------");
: System.out.println(" [1] store ");
: System.out.println(" [2] print ");
: System.out.println(" [3] search ");
: System.out.println(" [4] remove ");
: System.out.println(" [5] set ");
: System.out.println(" [6] calculate ");
: System.out.println(" [7] qiut ");
: System.out.println("-----------------------------------menu--------------------------------");
: System.out.print("Enter your Choice:");
: choice = scan.next().charAt(0);
:
: if (choice == '1')
: {
:
: System.out.println("enter the numbers");
: int number = scan.nextInt();
: for (int i = 0; i <numbers.length; i++) {
: //System.out.println(" - " + numbers[i]);
: }
:
:
:
: }
: else if (choice == '2')
: {
:
: System.out.print("Original contents: ");
: //System.out.println(" - " + numbers[i]);
:
: }
: else if (choice == '3')
: {
:
:
: }
: else if (choice == '4')
: {
:
:
: }
: else if (choice == '5')
: {
:
:
: }
: else if (choice == '6')
: {
:
:
:
: }
: else if (choice == '7')
:
: {
:
: System.out.println('\t' + "Thanx , have a lovely day");
: System.exit(0);
:
: }
:
:
:
:
: }
:
:
: }
: :
:
No-one is going to make your assignments for you. Please show some code to show that you have worked on it. Also ask more specific questions based on the code you wrote and have problems with.