Skip to content
Advertisement

I want to be able to compare two manga’s ratings but I don’t know how to make it so I can input two titles that then grabs the scores to compare

I have the data for 10 different manga set in an array list and they go as title, rating, ongoing or not, and amount of chapters. I want to be able to input two different manga titles into a scanner and then have it compare the rating of the two to see which is higher. This is the code I have so far. Thanks for your help in advance.

JavaScript

}

JavaScript

import java.util.Scanner;

public class TopMangaDataRunner { public static void main(String[] args) {

JavaScript

Advertisement

Answer

First you’re going to need to find the objects from your list that you want to compare. Easiest way is to just iterate over your list and check the title (assuming the title is within your list):

JavaScript

Then just compare your values and print out the title of the large one

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement