Questions
I need to create Create a new empty ArrayList, Ask the user for 5 items to...

I need to create Create a new empty ArrayList, Ask the user for 5 items to add to a shopping list and add them to the ArrayList (get from user via the keyboard). Prompt the user for an item to search for in the list. Output a message to the user letting them know whether the item exists in the shopping list. Use a method that is part of the ArrayList class to do the search. Prompt the user for an item to delete from the shopping list and remove it. (be sure to handle the case where they don’t want to delete anything). Use a method that is part of the ArrayList class to do the delete. Prompt the user for an item to insert into the list. Ask them what they want to insert and where they want to insert it (after which item). Use a method that is part of the ArrayList class to do the insertion. Output the final list to the user. It keeps giving me cannot define errors import java.util.ArrayList; import java.util.Scanner;

I keep getting cannot define errors

import java.util.ArrayList;
import java.util.Scanner;

public class ShoppingList {
   private static Scanner scanner = new Scanner(System.in);
   private static ShoppingList shoppingList = new ShoppingList();
  
   public static void main (String[] args) {
       boolean quit = false;
       int choice = 0;
       printInstructions();
      
       while(!quit) {
           System.out.println("Enter your choice: ");
           choice = scanner.nextInt();
           scanner.hasNextLine();
          
           switch(choice) {
           case 0:
               printInstructions();
               break;
              
           case 1:
               shoppingList.getShoppingList();
               break;
              
           case 2:
               addItem();
               break;
              
           case 3:
               modifyItem();
               break;
              
           case 4:
               removeItem();
               break;
              
           case 5:
               searchForItem();
               break;
              
           case 6:
               processArrayList();
               break;
              
           case 7:
               quit = true;
               break;
           }
       }
       }
       public static void printInstructions() {
           System.out.println("\nPress");
           System.out.println("\t - To Print The Instructions");
           System.out.println("\t - To Add Item");
           System.out.println("\t - To Modify Item");
           System.out.println("\t - To Remove Item");
           System.out.println("\t - To Search for an Item");
           System.out.println("\t - To Process Array List");
           System.out.println("\t - To Not Continue");
          
       }
      
       public static void addItem() {
           System.out.print("Add : Shopping Item: ");
           shoppingList.addShoppingItem(scanner.nextLine());
          
       }
       public static void modifyItem() {
           System.out.print("Modify: Enter the Item: ");
           String curItem = scanner.nextLine();
          
           System.out.print("Modify: Replace with: ");
           String newItem = scanner.nextLine();
          
           shoppingList.modifyShoppingItem(curItem, newItem);
          
       }
      
       public static void searchForItem() {
           System.out.print("Item Search: ");
           String searchItem = scanner.nextLine();
           if(shoppingList.onFile(searchItem)) {
               System.out.println("Item " + searchItem + " is on the list");
           }
           else {
               System.out.println(searchItem + "Is not found");
           }
       }
       public static void processArrayList() {
           ArrayList<String> newArrayList = new ArrayList<String>();
           newArrayList.addAll(shoppingList.getShoppingList());
          
           ArrayList<String> anotherArrayList = new ArrayList<>(shoppingList.getShoppingList());
          
           String[] myArray = new String[shoppingList.getShoppingList().size()];
           myArray = shoppingList.getShoppingList().toArray(myArray);
       }
public static void setShoppingList(ArrayList<String> shoppingList) {
   this.shoppingList = shoppingList;
           }
  
public void getShoppingList() {
   System.out.println("You have " + shoppingList.size() + " items")
   for(int i=0; i< shoppingListsize(); i++) {
       System.out.println((i+1) + " . " + shoppingList.get(i));
   }
}
public void modifyShoppingItem(String currentItem, String newItem) {
   int position = findItem(currentItem);
   if(position >= 0) {
       modifyShoppingItem(position, newItem);
   }
   }
private void modifyShoppingItem(int position, String item) {
   shoppingList.set(position, item);
   System.out.println("Shopping Item " + (item) + " has been modified");
}
public void removeItem(String item) {
   int position = findItem(item);
   if(position >= 0) {
       removeItem(position);
   }
}
private void removeItem(int position) {
   shoppingList.removeItem(position);
}
private int findItem(String searchItem) {
   return shoppingList.indexOf(searchItem);
}
public boolean onFile(String item) {
   int position = findItem(item);
   if(position >= 0) {
       return true;
   }
   return false;
}
}

In: Computer Science

•Preferred customers who order more than $1000 are entitled to a 5% discount, and an additional...

•Preferred customers who order more than $1000 are entitled to a 5% discount, and an additional 5% discount if they used the store credit card. •Preferred customers who do not order more than $1000 receive a $25 bonus coupon. •All other customers receive a $5 bonus coupon.Design the Logic in Structured English Design the Logic using Decision Tablex•Preferred customers who order more than $1000 are entitled to a 5% discount, and an additional 5% discount if they used the store credit card. •Preferred customers who do not order more than $1000 receive a $25 bonus coupon. •All other customers receive a $5 bonus coupon.

In: Computer Science

If a superclass is abstract, then its subclass must implement all of the abstract methods in...

If a superclass is abstract, then its subclass must implement all of the abstract methods in the superclass. Is this statement true or false?A. trueB. false

I appreciate if you add some descriptions

In: Computer Science

In the java programming language. How would you find if THREE (3) numbers in an array...

In the java programming language. How would you find if THREE (3) numbers in an array add up to a certain sum so for example if my array element consists of: INPUT: 200, 10, 50, 20 and my output asks if these elements add to: 270? YES (200+50+70) 260? YES (200+10+50) 30? NO What method would you suggest to look through the elements in an array (which im going to add through a text file) and determine if these sums exist in O(n^2)?

In: Computer Science

Does every algorithm have a running-time equation? In other words, are the upper and lower bounds...

Does every algorithm have a running-time equation? In other words, are the upper and lower bounds for the running time (on any specified class of inputs) always the same?

In: Computer Science

Write a program to compute answers to some basic geometry formulas. The program prompts the user...

Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is the length of a side. For the circles, this same value becomes the diameter. Use the meter value input to calculate the results in square (or cubic) meters and then print the answers in square (or cubic) meters. Area of a square (length times width) Area of a circle (pi times radius squared) How much bigger the area of the square is than the circle (see previous calculations) Round the length down to the next whole number of meters, compute the volume of a cube with this value as the length of its side Round the length up to the next whole number of meters, compute the volume of a cube with this value as the length of its side. You are to run the program three times using the following input values: 1000 1999.9 299.4 Please turn in the program and the outputs of running the program three times as directed. Be sure to use good style, appropriate comments and make use of constants in this program. Important Notes For the constant PI, please use 3.14159 Use the floor() and ceil() functions to round down and up respectively. For example, ceil(3.02) is 4. Be sure to #include to get access to these two functions Sample Output Your output format should look similar in style to the one below. Geometry formulas by (Your name) Enter one floating point number for length, 123.4 The number you entered is 123.4 cm or 12.34xx m. Area of square xx.xxxxxxx sq. m. Area of a circle xx.xxxxxxx sq. m. Difference is xx.xxxxxxxx sq. m. Cube volume rounded down is xx.xxxxxxxx cu. m. Cube volume rounded up is xx.xxxxxxxx cu. m. Press any key to continue

In: Computer Science

Write a program that read the input from user and convert it to binary and hex...

Write a program that read the input from user and convert it to binary and hex in C language.

In: Computer Science

Use the enum keyword or a C++ class to create a new type Boolean with the...

Use the enum keyword or a C++ class to create a new type Boolean with the two values F and T defined. Use the C++ class/struct keyword and an array to create a list of pairs that cover all possible combinations of the 2 Boolean constants you defined.

In: Computer Science

Cloud computing can be implemented in several different ways, please list and describe at least three...

Cloud computing can be implemented in several different ways, please list and describe at least three different ways.

In: Computer Science

What is project creep? Which system development methods are more prone to project creep? What could...

What is project creep? Which system development methods are more prone to project creep? What could be a strategy to avoid it? (400 words approx.)

In: Computer Science

Please type answer for i can copy it. Thank you very much. -Question 1 What is...

Please type answer for i can copy it. Thank you very much.

-Question 1

What is a polymorphism ?

-Question 2

Can you start an algorithm in pseudo code?


language is in (OOP) object oriented programming

In: Computer Science

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed....

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the following output:
Plan to be
spontaneous tomorrow.

2.

Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the results for the area of a triangle. Formula (1/2) x base x height.  

In: Computer Science

I am having trouble with printing the linked list from user input. Can someone tell me...

I am having trouble with printing the linked list from user input. Can someone tell me what I am doing wrong.

#include <iostream>
using namespace std;
struct node
{
   int info;
   node*link;
   node*current;
   node*prev;
   node * head;
   node * last;
}
;

void Insert(node*&head,node*&last,int n);
int SplitList(node*&head);
void print(node*&head);
int main()
{
   int num;
   node*h;
   node*l;
   cout << "Enter numbers ending with -999" << endl;
   cin >> num;
   Insert(h, l, num);
   print(h);
}

void Insert(node *&head,node*&last,int n)
{
   int count = 0;
   if (head == NULL)
   {
       head = new node;
       head->info = n;
       head->link = NULL;
       last = head;
       count++;
   }
   else {
       last->link = new node;
       last->link->info = n;
       last->link->link = NULL;
       last = last->link;
       count++;
   }
}
void print(node*&head)
{
   node *current; //pointer to traverse the list
   current = head; //set current so that it points to
                   //the first node
   while (current->link!= NULL) //while more data to print
   {
       cout << current->info << " ";
       current = current->link;
   }
}//end print

In: Computer Science

In java, write a program that asks the user to enter a character. Then pass the...

In java, write a program that asks the user to enter a character. Then pass the character to the following methods.

  1. isVowel() – returns true if the character is a vowel
  2. isConsonant() – returns true if the character is a consonant
  3. changeCase() – if the character is lower case then change it to upper case and if the character is in upper case then change it to lower case. (return type: char)

Example output is given below:

Enter a character

a

a is a vowel

a is not a consonant

a is equivalent to A

test case: e, E, d, D

Note: Java represents character using Unicode encoding and ‘A’ to ‘Z’ is represented by numbers 65 to 90 and ‘a’ to ‘z’ is represented by numbers 97 to 122. So to convert ‘A’ to ‘a’ you need to add (97-65) to A and then cast it to Character type since the addition will change its type to integer.

You can use the following code to read a character from console. When you call charAt(i) method for any String it returns the character at index i. The index of first character is 0, the index of second character is 1 and so on.

Scanner input = new Scanner(System.in);

char ch =input.next().charAt(0);

In: Computer Science

Imagine you are responsible for the performance improvement of an old computer system. Your boss told...

Imagine you are responsible for the performance improvement of an old computer system. Your boss told you that since a large budget for the new fiscal year has been approved and covers expenses with hardware upgrade you can just create a cluster computer with a large number of parallel processing units managed by some cluster operating system line MS-Windows Server 2019. You will not be able to make any changes to the software. Please, provide your recommendations for your boss regarding performance improvement by increasing parallel processing.

In: Computer Science