Question
100%

For any element in keysList with a value greater than 100, print the corresponding value in itemsList, followed by a space. Ex: If keysList = {42, 105, 101, 100} and itemsList = {10, 20, 30, 40}, print: 20 30

Since keysList.at(1) and keysList.at(2) have values greater than 100, the value of itemsList.at(1) and itemsList.at(2) are printed.

#include <iostream>
#include <vector>
using namespace std;

int main() {
const int SIZE_LIST = 4;
vector<int> keysList(SIZE_LIST);
vector<int> itemsList(SIZE_LIST);
unsigned int i;

for (i = 0; i < keysList.size(); ++i) {
cin >> keysList.at(i);
}

for (i = 0; i < itemsList.size(); ++i) {
cin >> itemsList.at(i);
}

/* Your solution goes here */

cout << endl;

return 0;
}

Please help me with this problem using c++.

Expert Solution

Want to see the full answer?

Check out a sample Q&A here
Blurred answer
Students who’ve seen this question also like:
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Not helpful? See similar books
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Using Methods, Classes, And Objects. 1GZ
marketing sidebar icon
Want to see this answer and more?
Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*
*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: For any element in keysList with a value greater than 50, print the corresponding value in…

A: Here we need to run a for loop for 4 times to check values in array keysList and then print the…

Q: Given the following two lists print the elements from the color list whose index is listed in the…

A: As per our guidelines we are supposed to answer only one question so please post the other question…

Q: Need help with the parts that say TODO in images , This may be needed scoresheet code below package…

A: Comments are lines of text in code that start with a specific set of characters like “//” in…

Q: JavaScript //6. addButtonListeners //a. Selects all buttons nested inside the main element //b. If…

A: The answer is given below:-

Q: • Create a Book class; where: Each book contains the following information: book title, book Author…

A: Program code: Filename: "Book.java" public class Book{   //Member Variables   private String title;…

Q: Given an ArrayUnboundedQueue of Strings called mygueue, and the following values for its fields:…

A: Note: As you have asked a multipart question, as per our policy we will solve the first three for…

Q: You have to make a new menu which show first menu like that 1.Enter 1 for using Doubly linkedList…

A: public class Person{        //declaring instance variables     private String name;…

Q: Create a Book class; where: Each book contains the following information: book title, book Author…

A: STEP-1: First of all, we need to create a Book class. To create the Book class, create a new…

Q: Submission Instructions Follow the instructions for How to Submit Programming Assignments.…

A: Following is the java program which takes as input string of integers from command line and save  it…

Q: It has one parameter, of type dict [str, str] of names and favorite colors. It returns a str which…

A: def mostFreq(dictA):                               # function to return most frequent value in a…

Q: Assume that the following method is within the KWLinkedList class, what does this method do? public…

A: Answer : Correct Option : A) Inserts a new node with its data as item after the first node of the…

Q: Hello.  I need to comment on this code.  Line 62  /* Comment Here */…

A: The answer to your questions is given in step 2:-

Q: Given two ArrayLists: list1-[10,20,30], and list2=[40,50], what is the content of the list1 after…

A: Answer: Option d) : [10,20,30,40,50]   list1.AddAll(list2) : AddAll operation adds all the elements…

Q: Assume you have a method (shown below) inside the KWArrayList class, what does this method do public…

A: Answer: Option C is correct. Swap the first and last element if the first is equal to the item and…

Q: Create a Book class; where: Each book contains the following information: book title, book Author…

A: Given:

Q: Create a Book class; where: Each book contains the following information: book title, book Author…

A: Code: //STARTimport java.util.LinkedList;import java.util.Random; class Book { String…

Q: Java Program Requirements: Create a DodecahedronList class that stores the name of the list and an…

A: The class DodecahedronList is created below meeting the specifications. 4 Dodecahedron objects are…

Q: In this assignment, you will compare the performance of ArrayList and LinkedList. More specifically,…

A: Here is the Code

Q: Which accesses the number of elements in groceryList?   ArrayList groceryList; groceryList = new…

A: Solution:

Q: JAVA LANGUAGE Create an ArrayList, Name it YourRegNoandName that can hold Integers, and fill each…

A: import java.util.*;import java.lang.*;import java.util.Scanner;public class main{    public static…

Q: Add one attribute and method to the parking office class below.  Attribute - parkingOfficeName :…

A: We need to add an attribute named parkingOfficeName which is of type String and a method named…

Q: Write a code using the following hints and apply HashMap and its methods get and put for public…

A: Below is the required code and sample output:

Q: package datastructure; public class UseMap { public static void main(String[] args) { /* *…

A: Given data, package datastructure; public class UseMap{ public static void main(String[] args) {…

Q: Create a Book classi where: lộ Each book contains the following information: book title, book Author…

A: the code is an given below : Book Class package projj; public class Book {String title; //attributes…

Q: Assume that the following method is within the KWLinkedList class, what does this method do? public…

A: The given code returns null when list is empty If list is not empty, then It stores address of 2nd…

Q: These players form one rope during the game. Initially, the character unit w is empty. In each move,…

A: Solution: Initially step through input for examination cases then, at that point, take the…

Q: A supermarket wants to reward its best customer of each day, showing the customer’s name on a screen…

A: Actually, Java is an Object Oriented Programming language which is platform independent and robust…

Q: returns elements at odd indices public interface SortedLinkedListInterface { // iterate over odd…

A: Traverse the list starting from position 1. Now increment the position by 2 after each iteration. By…

Q: struct ListNode *ReversePairIterative(struct ListNode *head) { struct ListNode *templ=NULL,…

A: Introduction:Here in the question one Iterative algorithm has been given and we have to convert this…

Q: Write assignments to the library, cs101, and track variables (which you defined in the previous…

A: In this problem, we will discuss about how to create appropriate array list objects.

Q: Remove first and last element from likedlist JAVA

A: Performing deletion from the front and behind of LinkedList. ( JAVA )

Q: Which of the following method is used to get the position of a particular element in an ArrayList?…

A: contain() --&gt;  This method check whether a string contains a sequence of character or not.…

Q: Consider records for patients at a medical facility. Each record contains an integer identification…

A: Actually, java is a object oriented programming language. because in this java language applications…

Q: Consider records for patients at a medical facility. Each record contains an integer identification…

A: Actually, java is a  class- based object oriented programming language. It is a platform…

Q: Consider records for patients at a medical facility. Each record contains an integer identification…

A: import java.util.ArrayList; public class PatientRecord { int ID; public int getID() {  return ID; }…

Q: Which of the above choices (A, B, C or D) prints the name of each animal in the animalList object…

A: For printing all the names from the given list of animals we need to iterate over each index of the…

Q: Create a class MapTester (either in your current project or in a new project). In it, use a HashMap…

A: import java.util.HashMap; //class MapTester implementation class MapTester{    //hashmap for…

Q: Assume the following method is within the KWLinkedList class, what does the following method do?…

A: ListIterator&lt;E&gt; iter1 = iterator( );      (iter1 is initialized with the first element of…

Q: [0] [1] [2] [3] myList "Bashful" "Awful" Jumpy" "Happy" The above "myList" is an ArrayList in Java…

A: Use ArrayList.add(int index, E element) method to add element to specific index of ArrayList. To…

Q: searchStudent: searches the studentsList by idNum, passed as parameter. If the object is found, it…

A: searchStudent: searches the studentsList by idNum, passed as parameter. If the object is found, it…

Q: Assignment Apex: Add a new method: //Name: getcontactInformationUsingInlinesoQL //Return Type: Map>…

A: given:

Q: Assignment Apex: Add a new method: //Name: getcontactInformationUsingInlinesoQL //Return Type: Map>…

A: The detailed solution in the below step.

Q: Assignment Apex: Add a new method: //Name: getcontactInformationUsingInlinesoQL //Return Type: Map>…

A: In this problem, we need to add a new method into the apex class with the above information. Please…

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: Given: Assignment Apex:Add a new method: //Name: getContactInformationUsingInlineSOQL //Return Type:…

Q: Assignment Apex: Add a new method: //Name: getcontactInformationUsingInlinesoQL //Return Type: Map>…

A: In this problem, we need to design a new method in the apex class according to the provided…

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: Please find the solution in the below step.

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: In this problem, we need to add a new method to the apex class and solve the problem.   Find the…

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: Given:

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: Required:

Q: Assignment Apex: Add a new method: //Name: getContactInformationUsingInlinesoQL //Return Type: Map>…

A: In this problem, we need to add a new method in the apex class.    Please find the solution in the…

Knowledge Booster
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • Use the Iterator Pattern: Create a class called Exercise, and then, in its main method, create an ArrayList called stringArrayList. Add the following five strings to stringArrayList: “one”, “two”, ”three”, ”four”, ”five”. Then, use a for loop and the index of stringArrayList to print all these five strings out to the console. 2. For stringArrayList above, can you use an iterator to traverse the five strings inside, without using the index? 3. If change stringArrayList into a TreeSet, how do you traverse the five strings use an iterator? Implement an Iterator: 4. Create a class called StringArray that is able to store a number of String objects. Create an instance variable, String[] values, (internal data storage) of StringArray to store all the strings. 5. Create a constructor for StringArray, which is able to build an object of StringArray using the parameter.                            public StringArray(String[] values)  6. Make the class StringArray implements Iterable So that it…
    Need help with the parts that say TODO in images , This may be needed scoresheet code below package edu.vtc.cis2271.yahtzee; import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Set; public class Scoresheet{ private static final int SMALL_STRAIGHT_SCORE = 30;private static final int LARGE_STRAIGHT_SCORE = 40;private static final int FULL_HOUSE_SCORE = 25;private static final int YAHTZEE_SCORE = 50;private static final int TOP_HALF_BONUS = 35;private static final int TOP_HALF_BONUS_LEVEL = 63; @SuppressWarnings("javadoc")public enum Category {Ones,Twos,Threes,Fours,Fives,Sixes,SmallStraight,LargeStraight,ThreeOfKind,FourOfKind, FullHouse, Yahtzee,Chance} public Scoresheet(){_scores = new int[Category.values().length];_listeners = new ArrayList<>();for (int i = 0; i < _scores.length; i++)_scores[i] = -1;} public void addScoreSheetListener(ScoreSheetListener listener){_listeners.add(listener);} public void…
    In this java assignment, we will need to use arraylists so we can store data for an employee. If the user wants to enter data for more than one employee, it should print like this: Employee ListId Name ----------------------- 1. First Name 2. Bob Smith   If the user only enters one employee, it should print out a paystub for that employee that would look like this (with overtime coming into play as well, paying an extra 50% beyond 40 hours): ------------------------------- Id - 1 Name - First M. Last Address - 1234 Main St, City, St, Zip Phone - 1234567890 Email - sample@gmail.com Hours worked - 45 Hourly Rate - $10 Regular Pay, 40 hours at $10/hr - $400 Overtime Pay, 5 hours at $15/hr - $75 Gross Total - $475 ------------------------------ Federal tax (20%) - $95 State Tax (5%) - $23.75 Fica Tax (3%) - $14.25 ------------------------------ Net Check - $342   The program should have one class per .java file all calling to a main.java file using getters and setters. Here are the…
  • In this assignment, you will create a Linked List data structure variant called a “Circular Linked List”. The Node structure is the same as discussed in the slides and defined as follows (we will use integers for data elements): public class Node {          public int data;          public Node next; }   For the Circular Linked List, its class definition is as follows:   public class CircularLinkedList {          public int currentSize;          public Node current; }   In this Circular Linked List (CLL), each node has a reference to an existing next node. When Node elements are added to the CLL, the structure looks like a standard linked list with the last node’s next pointer always pointing to the first. In this way, there is no Node with a “next” pointer in the CLL that is ever pointing to null. For example, if a CLL has elements “5”, “3” and “4” and “current” is pointing to “3”, the CLL should look like:   Key observations with this structure: The currentSize is 3 meaning there…
    JavaScript //6. addButtonListeners //a. Selects all buttons nested inside the main element //b. If buttons exist: //c. Loop through the NodeList of buttons //d. Gets the postId from button.dataset.postId //e. Adds a click event listener to each button (reference addEventListener) //f. The listener calls an anonymous function (see cheatsheet) //g. Inside the anonymous function: the function toggleComments is called with the //event and postId as parameters //h. Return the button elements which were selected //i. You may want to define an empty toggleComments function for now. Not all tests //will pass for addButtonListeners until toggleComments exists. I recommend //waiting on the logic inside the toggleComments function until we get there.
    Not allowed to add variables in brackets next to originIndex      * @return index of the point that is closest to the origin, which is (0, 0) In     *         case of a tie, return the lowest index     */    public int closestToOriginIndex() {
  • Java question  Use the Iterator Pattern: Create a class called Exercise, and then, in its main method, create an ArrayList called stringArrayList. Add the following five strings to stringArrayList: “one”, “two”, ”three”, ”four”, ”five”. Then, use a for loop and the index of stringArrayList to print all these five strings out to the console. 2. For stringArrayList above, can you use an iterator to traverse the five strings inside, without using the index? 3. If change stringArrayList into a TreeSet, how do you traverse the five strings use an iterator? Implement an Iterator: 4. Create a class called StringArray that is able to store a number of String objects. Create an instance variable, String[] values, (internal data storage) of StringArray to store all the strings. 5. Create a constructor for StringArray, which is able to build an object of StringArray using the parameter.                            public StringArray(String[] values)  6. Make the class StringArray implements…
    Which accesses the number of elements in groceryList?   ArrayList <String> groceryList;groceryList = new ArrayList<String>(); A. groceryList.size B. groceryList.length C.  groceryList.length( ) D. groceryList.size( )
    Consider a scenario of Contacts Database, in which all information of user contacts will be stored. In the given scenario you have to implement your database of contacts using the Generic Arraylist you have created in Task 1. Steps to Follow:Step 1:In first step you have to create Contact class with the following attributes;● First Name● Last Name● Phone Number● Email AddressAdd mutator and accessor methods for all given attributesStep 2:You have to create a menu consisting of the following functionalities;1. Add a new contact2. Display all contacts3. Display specific contact 4. Delete a contact5. Quit
  • You will also have to write Student Tests that test the following in the provided file.i. Adding element(s).ii. Get elements at index – (1) with a valid index and (2) with an invalid indexiii. Test equality of two StringArrayLists (of size 0, 2)iv. Test if a StringArrayList contains a String (test both true and false cases)v.Test removing a String from a StringArrayList.
    @return index of the point that is closest to the origin, which is (0, 0)   * In case of a tie, return the lowest index   */                                                                   public int closestToOriginIndex() {                                                                       return 0;   }
    Assume the following method is within the KWLinkedList class, what does the following method do? public boolean undefined( ) {           ListIterator<E> iter1 = iterator( );         ListIterator<E> iter2 = iterator(size - 1);         if (Iter1.hasNext() && iter2.hasPrevious())         {                if( iter1.next().equals (iter2.previous())                      return true;                else                      return false;         } }   If the last two elements of the list are equal, then the method will return true, else it will return false.   If the first element of the list is same as the last element of the list, then the method will return true else it will return false.   If the list is same in the forward and reverse direction, then the method will return true, else it will return false.   If the first two elements of the list are equal, then the method will return true, else it will return false.
    • SEE MORE QUESTIONS
    Recommended textbooks for you
  • EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
  • EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT