0

Java: public static className methodName(class[] param1, String param2)

Hello community, I'm new to java and stuck in one of the biggest mystery of OOP question. I'm not able to find accurate article or blog post on it. So I'm finally writing whole code. You will probably understand what is the question and needs to code. public class Solution{ public static void main(String[] args){ //code to read values //code to call required method //code to display the result } } // I'M STUCK IN BELOW CODE. I DON'T WHAT THIS CONCEPT IS CALLED. // IT IS OKAY IF YOU ARE NOT ABLE TO GET QUESTION BUT IF YOU KNOW // ANY SIMILAR TYPE QUESTION/CONCEPT PLEASE TELL // CONSIDER THIS AS // S O S public static Car getCar(Car[] carList, String carRegNo){ //method logic } public static int getACCarCount(Car[] carlist){ //method logic } class Car{ String regNo; double price; boolean isACCase; String company; } I manage to get the question, here it is... Create a class Car with below atrributes: regNo - String price - double isACCar - boolean company - String Write getter, setters and parameterized constructor in the above mentioned attribute sequence as required. Create class solution with main method. Implement two static methos - getCar and get getACCarCount in Solution class. getCar method: This method will take input parameters array of Car onjets and string parameter regNo. This method will return the Car Object for the given registration number. If no car with the given regNo is present in the array of Car objects, then the method should return null. getACCarCount method: This method will take the array of Car objects. The method will return the count of number of AC cars. If no AC Car is found it should return 0. The above mentioned static methods should be called from the main method. Use scanner to read user input. Sample Input: TS001 500000.0 true Maruthi TS002 700000.0 true Tata AP001 900000.0 true BMW AP002

6th May 2021, 5:07 PM
Fatehsingh parab
Fatehsingh parab - avatar
1 Answer
0
Post the question please..what should I code for?
6th May 2021, 5:11 PM
Aditya
Aditya - avatar