JAVA
You will then prompt the user to enter each grocery item and store it in your array. Afterward, the program will ask the user to enter which grocery item they are looking for in the list, and return a message back on whether it was found or not found.
(Hint: You will need two for-loops for this program - one for storing each element into the array and one for searching back through the array.) See below for example output:
Example output 1:
How many items would you like on your grocery list?
3
Enter item 1:
potato
Enter item 2:
cheesecake
Enter item 3:
bread
Welcome to your digital grocery list!
What item are you looking for?
bread
bread was found in your list!
Example output 2:
How many items would you like on your grocery list?
3
Enter item 1:
potato
Enter item 2:
cheesecake
Enter item 3:
bread
Welcome to your digital grocery list!
What item are you looking for?
muffins
muffins not found.
In: Computer Science
List the following elements in order of highest electronegativity to lowest: silicon, sulphur, argon, chlorine.
Answer the following questions about water: (10 marks total)
In a single molecule of water (H2O), what kind(s) of bonds(s) are present?
Explain how these bonds contribute to the high surface tension of water.
Explain why water has a high specific heat and explain why this is important to life.
A baking soda solution has a pH of 8. (5 marks total)
Is it acidic, basic, or neutral? Why?
Is it an acid, a base, or neither? Why?
What is the concentration of hydrogen ions in baking soda? (1 mark)
Compare and contrast the following: (4 marks each, total 16 marks)
Starch and glycogen
Phosphodiester bonds and peptide bonds
Chemical energy and heat
Hypothesis and null hypothesis
For the theory of evolution identify the pattern component and the process component.
Read the section in your textbook Canadian Research 1.1: Artificial Selection on Bighorn Sheep in Alberta. Using specific examples from this study, outline the steps of the scientific method. (Note that the reading may not include all the steps. For any “missing” steps, include what would have been the case.)
Answer the following questions about enzymes: (15 marks total)
Briefly describe how enzymes catalyze reactions
List 4 factors that affect enzyme activity. For each factor explain how the factor works to alter reaction rate.
The tertiary structure of proteins involves interactions with the amino acid side chains (the R groups). List the types of interactions and explain the role of the functional groups involved .
Compare and contrast the structure and function of DNA and RNA.
Explain why the components of phospholipids contribute to the formation of lipid bilayers.
Explain why carbohydrates have high free energy.
Discussion
Based on what you have learned so far, consider one of the following questions. Post your ideas to the Discussions area first, and then read and respond to other students’ postings. The Discussions area is in the left-hand navigation menu of this course.
Self-Replicating Molecules
Your textbook states that the ability of molecules to self-replicate is an indicator that these molecules are “living entities”. Should self-replication be the only indicator of life? Why or why not?
Origins of Life
Up to date RNA has been the only molecule directly associated with the origin of life and early evolution of life on Earth.
In your own words explain how researchers came to this conclusion. Do you find their arguments convincing? Why or why not? Prior to answering this question, make sure you read Chapter 4, Section 4.4, The First-Life Form.
In: Biology
I have added the MyList.java all the way on the bottom.
Thats all the detail I have for this and what kind of more detail information you need.
Plz Write the program in Java. And Plz post the running program with main and test.Thanks.
Implementing Lists:
Start by carefully reading Listing 24.5: MyLinkedList.java (on page 938 of the 11th Edition of the text). Note that the listing is incomplete. Your assignment is to implement a revised MyLinkedList class after you have included all the code needed to fill in and complete all the methods that were omitted. Next, write a (main) driver program that initializes a linked list with 10 names (your choice), and then completely tests every one of its methods of ensure that the class meets all its requirements.
Listing 24.5
MyLinkedList.java
1 public class MyLinkedList implements MyList {
2 private Node head, tail;
3 private int size = 0; // Number of elements in the list
4
5 /** Create an empty list */
6 public MyLinkedList() {
7 }
8
9 /** Create a list from an array of objects */
10 public MyLinkedList(E[] objects) {
11 for (int i = 0; i < objects.length; i++)
12 add(objects[i]);
13 }
14
15 /** Return the head element in the list */
16 public E getFirst() {
17 if (size == 0) {
18 return null;
19 }
20 else {
21 return head.element;
22 }
23 }
24
25 /** Return the last element in the list */
26 public E getLast() {
27 if (size == 0) {
28 return null;
29 }
30 else {
31 return tail.element;
32 }
33 }
34
35 /** Add an element to the beginning of the list */
36 public void addFirst(E e) {
37 // Implemented in Section 24.4.3.1, so omitted here
38 }
39
40 /** Add an element to the end of the list */
41 public void addLast(E e) {
42 // Implemented in Section 24.4.3.2, so omitted here
43 }
44
45 @Override /** Add a new element at the specified index
46 * in this list. The index of the head element is 0 */
47 public void add(int index, E e) {
48 // Implemented in Section 24.4.3.3, so omitted here
49 }
50
51 /** Remove the head node and
52 * return the object that is contained in the removed node.
*/
53 public E removeFirst() {
54 // Implemented in Section 24.4.3.4, so omitted here
55 }
56
57 /** Remove the last node and
58 * return the object that is contained in the removed node.
*/
59 public E removeLast() {
60 // Implemented in Section 24.4.3.5, so omitted here
61 }
62
63 @Override /** Remove the element at the specified position in
this
64 * list. Return the element that was removed from the list.
*/
65 public E remove(int index) {
66 // Implemented earlier in Section 24.4.3.6, so omitted
67 }
68
69 @Override /** Override toString() to return elements in the list
*/
70 public String toString() {
71 StringBuilder result = new StringBuilder("[");
72
73 Node current = head;
74 for (int i = 0; i < size; i++) {
75 result.append(current.element);
76 current = current.next;
77 if (current != null) {
78 result.append(", "); // Separate two elements with a comma
79 }
80 else {
81 result.append("]"); // Insert the closing ] in the string
82 }
83 }
84
85 return result.toString();
86 }
87
88 @Override /** Clear the list */
89 public void clear() {
90 size = 0;
91 head = tail = null;
92 }
93
94 @Override /** Return true if this list contains the element e
*/
95 public boolean contains(Object e) {
96 // Left as an exercise
97 return true;
98 }
99
100 @Override /** Return the element at the specified index
*/
101 public E get(int index) {
102 // Left as an exercise
103 return null;
104 }
105
106 @Override /** Return the index of the head matching element
in
107 * this list. Return −1 if no match. */
108 public int indexOf(Object e) {
109 // Left as an exercise
110 return 0;
111 }
112
113 @Override /** Return the index of the last matching element
in
114 * this list. Return −1 if no match. */
115 public int lastIndexOf(E e) {
116 // Left as an exercise
117 return 0;
118 }
119
120 @Override /** Replace the element at the specified
position
121 * in this list with the specified element. */
122 public E set(int index, E e) {
123 // Left as an exercise
124 return null;
125 }
126
127 @Override /** Override iterator() defined in Iterable */
128 public java.util.Iterator iterator() {
129 return new LinkedListIterator();
130 }
131
132 private class LinkedListIterator
133 implements java.util.Iterator {
134 private Node current = head; // Current index
135
136 @Override
137 public boolean hasNext() {
138 return (current != null);
139 }
140
141 @Override
142 public E next() {
143 E e = current.element;
144 current = current.next;
145 return e;
146 }
147
148 @Override
149 public void remove() {
150 // Left as an exercise
151 }
152 }
153
154 private static class Node {
155 E element;
156 Node next;
157
158 public Node(E element) {
159 this.element = element;
160 }
161 }
162 }
MyList.java
public interface MyList extends java.lang.Iterable {
//Add a new element at the end of this list
public void add(E e);
//Add a new element at the specified index in this list
public void add(int index, E e);
//Clear the list
public void clear();
//Return true if this list contains the element
public boolean contains(E e);
//Return the element from this list at the specified index
public E get(int index);
//Return the index of the first matching element in this list.
//Return -1 if no match.
public int indexOf(E e);
/** Return true if this list contains no elements */
public boolean isEmpty();
/** Return the index of the last matching element in this list
* Return -1 if no match. */
public int lastIndexOf(E e);
/** Remove the first occurrence of the element o from this list.
* Shift any subsequent elements to the left.
* Return true if the element is removed.
*/
public boolean remove(E e);
/** Remove the element at the specified position in this list
* Shift any subsequent elements to the left.
* Return the element that was removed from the list.
*/
public E remove(int index);
/** Replace the element at the specified position in this list
* with the specified element and returns the new set.
* */
public Object set(int index, E e);
/** Return the number of elements in this list */
public int size();
}In: Computer Science
In 6A, you created an object class encapsulating a Trivia Game which INHERITS from Game.
Now that you have successfully created Trivia objects, you will continue 6B by creating a linked list of trivia objects. Add the linked list code to the Trivia class.
Your linked list code should include the following: a TriviaNode class with the attributes:
1. trivia game - Trivia object
2. next- TriviaNode
3. write the constructor, accessor, mutator and toString methods.
A TriviaLinkedList Class which should include the following attributes:
1. head - TriviaNode
2. number of items – integer
3. write the code for the constructor, accessor and mutator, and toString methods.
4. methods to insert a triviaNode on the list - You may assume inserts always insert as the first node in the list.
5. write a method to delete a node by passing the node id of the game to delete. Take into consideration that the game may not exist in the list. Your method should let the user know that the node was successfully deleted or not.
Write a client to test all aspects - creating trivia objects, inserting the objects as nodes to the list, deleting a node by passing the id of the trivia game. Print out the list every time you make a change such as adding a node and deleting a node. You should create at least 5 objects to be inserted to your list, then delete at least 1. Also, test deleting an object that is not in the list.
6B. In this module, you will combine your knowledge of class objects, inheritance and linked lists. You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game.
Game is the parent class with the following attributes:
Trivia is the subclass of Game with the additional attributes:
1. trivia game id - integer
2. ultimate prize money - double
3. number of questions that must be answered to win - integer.
4. write the accessor, mutator, constructor, and toString methods.
Write a client class to test creating 5 Trivia objects. Once you have successfully created Trivia objects, you will continue 6B by adding a linked list of trivia objects to the Trivia class.
In: Computer Science
Please TYPE approximately 300 words discussing the following:
List and describe various features of electronic systems.
List and discuss the steps in designing an embedded system.
In: Electrical Engineering
List the characteristics of money
Functions and motives of money
Fiscal and monetary policies (how to control money supply)
List the main functions of Commercial and Central Banks
In: Economics
Choose a local business in your area and make a list of its stakeholders. Are some more important than others? If so, list them in order of priority.
In: Accounting
Coca-Cola company
Opportunity Analysis 1. List your organization's biggest opportunities.
Threat Analysis 1. List your organization's biggest threats.
In: Economics
Write and run the SQL to list the different expected graduation dates [class of 20XX] in the BSU_Students table. List each expected graduation date only once.
In: Computer Science
Write an algorithm for combining two skip lists in O(a + b) time, where a is the number of keys in the first list, and b is the number of keys in the second list.
In: Computer Science