Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with this question in JAVA. Please make sure you get the expected output shown below and follow the given code. Thank you
Please help me with this question in JAVA. Please make sure you get the expected output shown below and follow the given code.
Thank you so much. I really appreciate your help.
INPUT and OUTPUT:
GIVEN CODE
ESG Issuer Graph Programming challenge description: ESG Issuer Data is of the form Issuer | Parent | ESG Rating A54365 | B34454 | AA B34454 | 034563 | A D45747 | B34454 | B E36547 045747 | AAA G34657 | 045747 | CCC H84464 | C34563 | BB 176474 | H84464 | AA C34563 | BBB F34654 1 | BB 174576 | K46565 | C K465651 | CC L54334 | 176474 | AA H84464 | L54334 | BB Assumptions that can be made: 1. If asked to find a min or max rating, given an issuer, consider all the issuers in the path from the given issuer to the ultimate parent 2. Rating order AAA > AA > A > BBB > BB > B> CCC > CC > C Your assignment: Come up with a Data Structure to hold this type of data. Write an algorithm to check if the relations above are cyclic in nature. (Convert the Data Structure to a directed one assuming the direction is from the Issuer to its parent) Find the issuer with max rating Input: The issuer table, with respective columns: Issuer Parent EstRating, separated by I Output: If relations from the input table are cyclic in nature (cyclic or noncyclic issuer with max rating, return None if invalidot applicable max rating, return None if invalidot applicable Test 1 Test Input 6 A54365|B34454|AA B344541C34563|A D45747|B34454|B E36547|D45747|AAA G34657|D45747|CCC H84464|C34563 | BB 176474 | H84464 |AA C34563||BBB F34654||BB J74576|K465651C K46565||CC L54334|176474|AA H84464|L54334 | BB Expected Output cyclic A54365 AA Test 2 Test Input A54365|B34454 |CCC B34454|C34563|A D45747|B34454|B E36547 |D45747 |AAA G34657|D45747 CCC H84464|C34563 | BB 176474|H84464 |AA C345631 | BBB F34654| BB J74576|K46565|C K465651 | CC L54334|176474|AA H84464| | BB Expected Output noncyclic C34563 BBB 8 11 1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 import java.nio.charset.StandardCharsets; 5 6 /** 7 * The Main class implements an application that reads lines from the standard input * and prints them to the standard output. 9 */ 10 public class Main { /** 12 * Iterate through each line of input. 13 */ 14 public static void main(String[] args) throws IOException { 15 InputStreamReader reader = new InputStreamReader (System.in, StandardCharsets.UTF_8); 16 BufferedReader in = new BufferedReader (reader); 17 String line; 18 while ((line in.readLine()) != null) { 19 System.out.println(line); 20 } 21 } 22 } 0 0 0 23 ESG Issuer Graph Programming challenge description: ESG Issuer Data is of the form Issuer | Parent | ESG Rating A54365 | B34454 | AA B34454 | 034563 | A D45747 | B34454 | B E36547 045747 | AAA G34657 | 045747 | CCC H84464 | C34563 | BB 176474 | H84464 | AA C34563 | BBB F34654 1 | BB 174576 | K46565 | C K465651 | CC L54334 | 176474 | AA H84464 | L54334 | BB Assumptions that can be made: 1. If asked to find a min or max rating, given an issuer, consider all the issuers in the path from the given issuer to the ultimate parent 2. Rating order AAA > AA > A > BBB > BB > B> CCC > CC > C Your assignment: Come up with a Data Structure to hold this type of data. Write an algorithm to check if the relations above are cyclic in nature. (Convert the Data Structure to a directed one assuming the direction is from the Issuer to its parent) Find the issuer with max rating Input: The issuer table, with respective columns: Issuer Parent EstRating, separated by I Output: If relations from the input table are cyclic in nature (cyclic or noncyclic issuer with max rating, return None if invalidot applicable max rating, return None if invalidot applicable Test 1 Test Input 6 A54365|B34454|AA B344541C34563|A D45747|B34454|B E36547|D45747|AAA G34657|D45747|CCC H84464|C34563 | BB 176474 | H84464 |AA C34563||BBB F34654||BB J74576|K465651C K46565||CC L54334|176474|AA H84464|L54334 | BB Expected Output cyclic A54365 AA Test 2 Test Input A54365|B34454 |CCC B34454|C34563|A D45747|B34454|B E36547 |D45747 |AAA G34657|D45747 CCC H84464|C34563 | BB 176474|H84464 |AA C345631 | BBB F34654| BB J74576|K46565|C K465651 | CC L54334|176474|AA H84464| | BB Expected Output noncyclic C34563 BBB 8 11 1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 import java.nio.charset.StandardCharsets; 5 6 /** 7 * The Main class implements an application that reads lines from the standard input * and prints them to the standard output. 9 */ 10 public class Main { /** 12 * Iterate through each line of input. 13 */ 14 public static void main(String[] args) throws IOException { 15 InputStreamReader reader = new InputStreamReader (System.in, StandardCharsets.UTF_8); 16 BufferedReader in = new BufferedReader (reader); 17 String line; 18 while ((line in.readLine()) != null) { 19 System.out.println(line); 20 } 21 } 22 } 0 0 0 23Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started