Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Explain me this Java problem of Student marks , you dont need to write the code you just have to explain the logic that is
Explain me this Java problem of Student marks , you dont need to write the code you just have to explain the logic that is used in this below problem and you have to explain the whole scenario that is used in this..
What are the steps that need to be follow while performing this question?
1. Student Marks Title: Student Create a class Student with below attributes: id - int name - String marks - double age - Int Write getters, setters and parameterized constructor in the above mentioned attribute sequence as required. Create class Solution with main method Implement two static methods - searchStudentByMarks and findStudentWithMaximumAge in Solution class. searchStudentByMarks Create a static method searchStudentByMarks in the Solution class. This method will take array of Student objects and Marks as input and returns the Student object having the mentioned Marks. If no studnet is found with the given marks then method returns null. findStudentWithMaximumAge Create a static method findStudentWithMaximumAge in the Solution class. This method will take array of Student objects and returns the Student object having the maximum Age. These methods should be called from the main method. Write code to perform the following tasks: 1. Take necessary input variable and call searchStudentByMarks. For this method . The main method should print the Student object details as it is, if the returned value is nottake array of Student objects and returns the Student object having the These methods should be called from the main method, Write code to perform the following tasks: 1. Take necessary input variable and call searchStudentByMarks. For this method - The main method should print the Student object details as it is, if the returned value is not null, else it should print "No Student found with mentioned marks." 2. Take necessary input variable and call findStudentWithMaximumAge. For this method - The main method should print the Student object with maximum of mentioned attribute as it is if the returned value is not null, else it should print "No Student found." The above mentioned static methods should be called from the main method. Also write the code for accepting the inputs and printing the outputs. Don't use any static test or formatting for printing the result. Just invoke the method and print the result Note : All String comparison needs to be case in-sensitive You can use/refer the below given sample input and output to verify your solution. Sample Input (below) description: The 1st input taken in the main section is the number of Student objects to be added to the list of Student. The next set of inputs are id, name, marks, age for each Student object taken one after other and is repeated for number of Student objects given in the first line of input. The last line of inputs will be the arguments which needs to be passed as parameter to the methods. Consider below sample input and output to test your code: Sample Input 1 - public 4 105 Nisha 35 26methods. Consider below sample input and output to test your code: Sample Input 1 - public 4 105 Nisha 35 26 107 Uma 15 32 101 manu 43 24 112 delma 26 23 43 Sample Output 1 id-101 name-manu marks-43.0 age-24 id-107 name-Uma marks-15.0 age-32112 delma 26 23 43 Sample Output 1 id-101 name-manu marks-43.0 age-24 id-107 name-Uma marks-15.0 age-32 Sample Input 2 - public 4 106 manu 38 23 100 Uma 10 24 104 ra 30 25 101 kalamarks-15.0 age-32 Sample Input 2 - public 4 106 manu 38 23 100 Uma 10 24 104 raj 30 25 101 kala 43 33 40 Sample Output 2 No Student found with mentioned marks. id-101 name-kala marks-43.0 age-33raj 30 25 101 kala 43 33 40 Sample Output 2 No Student found with mentioned marks. id-101 name-kala marks-43.0 age-33 Note on using Scanner object: Sometimes scanner does not read the new line character while invoking methods like nextint(), nextDouble() etc. Usually, this is not an issue, but this may be visible while calling nextLine() immediately after those methods. Consider below input values: 100 Paragon Referring below code: Scanner sc = new Scanner(System.in); int x = sc.nextint(); String str = sc.nextLine(); -> here we expect str to have name.Instead it may be ". If above issue is observed, then it is suggested to add one more explicit call to nextLine() after reading numeric valueStep 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