Skip to main content

Posts

Showing posts from February, 2023

TCS Xplore 2023 Ion Proctored Exam ( IPA) 4 - JAVA coding solution ( 35 marks )

 Problem Statement :  Subscribe Please :  Click here Write a java program in which - 1. declare a class Team and make attributes as -         int - tId , String tName , String tCategory , String tGameName ,int tNumberOfPlayer and along with the constructor . All the attribute should be private and implement the getter and setter . 2. Write a Solution class with main method . where you have to implement a static method findTeam in which you have to pass three input , Array object , String parameter as category and int parameter as number of player . 3. in findTeam method , you have to implement it and if any of the array object value matched with the given condition then it should return that object or else print " no match Found ". condition : String parameter must match with the tCategory of array object and int parameter must match with the tNumberOfPlayer and tCategory must be divisible with tNumberOfPlayer . 4. in output you have print all the details of the returned obje

TCS Xplore 2023 Ion Proctored Exam ( IPA) 4 - JAVA coding solution ( 15 marks )

 Problem Statement :  Write a java program where you have to take a input a integer value from user and print the number of even digits in the given input . if there is no any even digit , print 0 or else print the number of even digits . Input : 123456 Output : 3 (as 2,4,6 are the even digits ) Input : 135791 Output : 0 (as there are no even digits ) Kindly Subscribe the channel :  Click here Source Code : import java.util.*; public class Problem17 {     public static void main ( String [] args ) {         Scanner sc = new Scanner ( System . in );         int num = sc . nextInt ();         int count = 0 ;         while (num!= 0 ){             int d =num% 10 ;             if (d% 2 == 0 ){                 count++;             }             num/= 10 ;         }         System . out . println (count);     }     }

TCS IPA previous year problem 10 , solved [input + output ] in JAVA - (35 marks )

 Problem Statement :  Video Link :    Create a class Phone with below attributes: phoneId - int os - String brand - String price - 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 - findPriceForGivenBrand and getPhoneIdBasedOnOs in Solution class. findPriceForGivenBrand method: This method will take two input parameters - array of Phone objects and string parameter brand. The method will return the sum of the price attribute from phone objects for the brand passed as parameter. If no phones with the given brand is present in the array of phone objects, then the method should return 0. getPhoneIdBasedOnOs method: This method will take a String parameter os, along with the array of Phone objects. The method will return the phone object, if the input String parameter matches with the os attribute of the phone object and its price attribute is greater than or