Skip to main content

Posts

Showing posts with the label tcs ipa java

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 ...

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

  Problem Statement :  Video Link :   Click Here Create a class AutonomousCar with the below attributes: carld – int brand – String   noOfTestsConducted – int noOfTestsPassed- int environment – String grade – String Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence except grade. Create class Solution with main method. Implement two static methods – findTestPassedByEnv and updateCarGrade in Solution class. findTestPassedByEnv method: This method will take two input parameters -array of AutonomousCar objects and string parameter environment. The method will return the sum of the noOfTestsPassed attribute from autonomousCar objects for the environment passed as parameter. If no autonomousCar with the given environment is present in the array of AutonomousCar objects, then the method should return 0. updateCarGrade method: This method will take a String parameter brand, along with the array of Auton...

TCS IPA previous year practice problem 7 ( in JAVA ) ---- ( 15 marks )

  Problem Statement :-  Write a program to print the smallest vowel in a given string ...... Input :           Matrix  output :            a Explanation :      The vowels in the given string are  a  and  i . And the alphabetically smallest between them        is  a . Video Link :    Click here to watch video on youtube Code : import java . util . Scanner ; public class Solution4 {     public static void main ( String [] args ) {         Scanner sc = new Scanner ( System . in );         String word = sc . nextLine ();         String vowels []={ "a" , "e" , "i" , "o" , "u" };         for ( int i = 0 ; i < vowels . length ; i ++){             if ( word . contains ( vowels [ i ])){           ...