1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zavuch27 [327]
3 years ago
14

Write the getNumGoodReviews method, which returns the number of good reviews for a given product name. A review is considered go

od if it contains the string "best" (all lowercase). If there are no reviews with a matching product name, the method returns 0. Note that a review that contains "BEST" or "Best" is not considered a good review (since not all the letters of "best" are lowercase), but a review that contains "asbestos" is considered a good review (since all the letters of "best" are lowercase). Complete method getNumGoodReviews. /** Returns the number of good reviews for a given product name, as described in part (b). */ public int getNumGoodReviews(String prodName)
Computers and Technology
1 answer:
Naya [18.7K]3 years ago
3 0

Answer:

Check the explanation

Explanation:

ProductReview.java

public class ProductReview {

  private String name;

  private String review;

 

  public ProductReview(String name, String review) {

      super();

      this.name = name;

      this.review = review;

  }

  public String getName() {

      return name;

  }

  public String getReview() {

      return review;

  }

 

 

}

ReviewCollector.java

import java.util.ArrayList;

public class ReviewCollector {

  private ArrayList<ProductReview> reviewList;

  private ArrayList<String> productList;

  public ReviewCollector(ArrayList<ProductReview> reviewList, ArrayList<String> productList) {

      super();

      this.reviewList = reviewList;

      this.productList = productList;

  }

  public void addReview(ProductReview prodReview) {

      this.reviewList.add(prodReview);

  }

  public int getNumGoodReviews(String prodName) {

      int count = 0;

      ArrayList<ProductReview> set = new ArrayList<>();

      for (int i = 0; i < reviewList.size(); i++) {

          if (reviewList.get(i).getName().compareToIgnoreCase(prodName) == 0) {

              set.add(reviewList.get(i));

          }

      }

      if(set.size()==0)

          return count;

     

      for (int i = 0; i < set.size(); i++) {

          if (set.get(i).getReview().contains("best")) {

              count++;

          }

      }

      return count;

  }

}

You might be interested in
____ contain instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the sy
AnnyKZ [126]

The Motherboard contains instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the systemroot\Windows\System32\Drivers folder.

Learned this in middle school, your welcome ;)

3 0
3 years ago
Rows within a spreadsheet are identified by:
EleoNora [17]

Answer:

Option C: Numbers.

Explanation:

By default, rows within a spreadsheet are identified by Numbers i.e. 1,2,3,............

Total rows are 1048575 in one spreadsheet.

7 0
3 years ago
You have been asked to analyze the Excel data provided by your IT department. You would like to have the ability to sort and fil
Stolb23 [73]

Answer:

Sort data in a range or table

Excel for Microsoft 365 Excel for the web Excel 2021 Excel 2019 Excel 2016 Excel 2013 More...

Sorting data is an integral part of data analysis. You might want to arrange a list of names in alphabetical order, compile a list of product inventory levels from highest to lowest, or order rows by colors or icons. Sorting data helps you quickly visualize and understand your data better, organize and find the data that you want, and ultimately make more effective decisions.

You can sort data by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest) in one or more columns. You can also sort by a custom list you create (such as Large, Medium, and Small) or by format, including cell color, font color, or icon set.

Notes:

To find the top or bottom values in a range of cells or table, such as the top 10 grades or the bottom 5 sales amounts, use AutoFilter or conditional formatting.

For more information, see Filter data in an Excel table or range, and Apply conditional formatting in Excel .

WindowsWeb

Sort text

Select a cell in the column you want to sort.

On the Data tab, in the Sort & Filter group, do one of the following:

To quick sort in ascending order, click A to Z command in Excel that sorts A to Z or smallest number to largest (Sort A to Z).

To quick sort in descending order, click Z to A command in Excel that sorts Z to A or largest number to smallest (Sort Z to A).

Explanation:

5 0
2 years ago
What’s the purpose of balancing or monitoring your checking account?
emmasim [6.3K]
B) To help you calculate how much money you have in your account.
3 0
3 years ago
Read 2 more answers
What type of storage drive contains multiple spinning platters?
Gala2k [10]

The type of storage drive that contains multiple spinning platters is called; Hard disk drives

<h3>What is the hard disk drive?</h3>

A computer hard disk drive (HDD) is a non-volatile data storage device. Non-volatile refers to storage devices that maintain stored data when turned off.

Now, the correct answer to the question is hard disk drives. This is because a hard disk drive is comprised of a stack of spinning metal disks known as platters. Each spinning disk has trillions of tiny fragments that could possibly be magnetized in order to represent bits (1s and 0s in binary code).

Read more about Hard disk drives at; brainly.com/question/24498473

#SPJ12

8 0
2 years ago
Other questions:
  • Who is good with Introduction to photography? I don’t know nothing about cameras if you do please contact me ASAP
    13·1 answer
  • How do u get rid of this (the grey box)
    6·2 answers
  • What is one problem you should keep in mind when researching information on the Internet?
    6·2 answers
  • When using the boolean data type, we encapsulate the data in what symbol?
    11·2 answers
  • True/False: When you make a function call, the order of the arguments you send does not matter as long as the number of argument
    15·1 answer
  • The expressions in each part of an AND or OR expression use ________ evaluation; that is, they are evaluated only as much as nec
    9·1 answer
  • my airpods just do not seem to connect if i try to pair them, reset them, they have this continuous green light, please help me
    12·1 answer
  • Explain the basic method for implementing paging.
    13·1 answer
  • ______ is the ability of a system to do more than one thing at a time. A. Multibusing c. online processing b. Multiprocessing d.
    13·1 answer
  • Describe the method used by operating systems to differentiate between TCP connections.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!