Skip to main content

Posts

22 may 2022, cpa java coding solution.(create a class RRT......).

 Q2. Create the class RRT(Rapid response team) with the below attributes: ticketNo-int raisedBy-String  assignedTo-String priority-int project-String All attributes should be private,write getters and setters and  parameterized constructor as required. Create class MyClass with main method. Implement a static method-getHighestPriorityTicket in MyClass class. getHighestPriorityTicket method:      This method will take an array of RRT objects ,and a String value as  parameters.This method will return the RRT object with highest priority ticket from the array of the RRT objects for the given project(String  parameter passed).Highest priority is the one which has lesser value. for example:1 is considered as high priority and 5 is considered as  low priority.    If no RRT with the above condition is present in the array of the  RRT objects,then the method should return null.    The main method should print the ticketNo,raisedBy and assignedTo from returned object if the returned object is n

22 may 2022 TCS CPA JAVA CODING QUESTION SOLVED.(reverse number if odd,else print cannot reverse.)

 Q1.Write main method in the MyClass class. In the main method,read an int value.Reverse the number and print it  only if the given number is odd.Else print the String "Cannot reverse". for example if the given number is 123 which is an odd number, we need to reverse the number and output should be 321. sample input1: 123 output: 321 sample input2: 788 output: Cannot reverse. *********************************************************************************** code: import java.util.Scanner; public class MyClass { public static void main (String[] args) { Scanner sc= new Scanner(System. in ) ; int num=sc.nextInt() ; sc.nextLine() ; if (num% 2 == 0 ) { System. out .println( "Cannot reverse" ) ; } else { int res= 0 ; int temp=num ; while (temp> 0 ) { int rem=temp% 10 ; res=res* 10 +rem ; temp=temp/ 10

28 february IRA JAVA solution.

Question:  Create a class Music with below attributes: playListNo - int type -String count - int duration(minutes) -double. The above attributes should be private.Write Getter and Setter and  parametrized constructor as required. Create class Solution with main method. **************************************************************************** Implement two static methods: findAvgOfCount and sortTypeByDuration in  Solution Class. findAvgOfCount Method:    This method will take an array of Music objects and an int value as input parameters.The method will find out Average (as int) of count for those  objects whose count is more than the given Count(int parameter passed).This  method will return average if found.If there is no Type that matches then  the method should return 0. for this method- main method should print average ,if the returned value is not 0.If the returned value is 0 then main method should print  "No playlist found". sortTypeByDuration method:    This method

7 march ira solution

import java.util.Scanner; import java.util.Arrays; public class Solution {     public static void main(String[] args) {         Scanner sc=new Scanner(System.in);         Gift[] gifts=new Gift[5];         for (int i = 0; i <5 ; i++) {              int a=sc.nextInt();sc.nextLine();              String b=sc.nextLine();              int c=sc.nextInt();sc.nextLine();              String d=sc.nextLine();           gifts[i]=   new Gift(a,b,c,d);         }         String input=sc.nextLine();          Gift ans1=getLowestPricedGiftByBrand(gifts,input);          if(ans1==null)          {              System.out.println("No such gift found");          }          else {              System.out.println(ans1.getGiftId());              System.out.println(ans1.getGiftName());              System.out.println(ans1.getPrice());              System.out.println(ans1.getBrand());          }         Gift ans2= getThirdHighestPricedGift(gifts);          if(ans2==null)          {              Syst

Solving TCS IRA Java Question asked by my Subscriber. |TCS IRA | TCS PRA |TCS CPA |TCS IPA

Question:  create the class Song with below attributes. songId - int    title - String  artist -  String duration-double The above attributes should be private, getters, setters and parameterized  constructor as required.  Create class MyClass with main method. implement two static methods - findSongDurationForArtist and getSongsInAscendingOrder in MyClass class. findSongDurationForArtist method: This method will take two input  parameters of Song objects and String parameter The method will return  the sum of song duration from array of Song object for the giver  artist (String parameter passed). If no Song with the given artist is present in the array of Song objects,   then the method should return zero. getSongsInAscendingOrder method: This method will take input parameters  array, of Song objects and String parameter.The method will return Song  objects array in an ascending order of their duration, from the array of  Song objects whose artist attribute matches with the input Stri

pra mock java solution .

  Question: Create a class College with the below attributes.  id-int   name -String   contactNo-int address-String  pinCode-int Write the getters and setters and parametrized constructor in the above  mentioned sequence as required. Create the class Solution with the main method. Implement the two static methods:  1.findCollegeWithMaximumPincode   2.searchCollegeByAddress findCollegeWithMaximumPincode method:    Create the Static method in the Solution Class.  This method will take array of the College objects and return the  College object having maximum pincode if found else return null if not  found.    for this method ,main method will print College object with maximum pincode if the returned value is not null.if the returned value is null , then the main method will print "No college found with mentioned attribute". searchCollegeByAddress method:    Create the Static method in the Solution Class. This method will take array of College objects as input and address as  in

feb 7 IRA JAVA SOLUTION

Create the class Student with below Attributes: studentId-int studentName-String score- int collegeName-String The above attribute should be private ,write getters and setters and  parametrized constructor as required.Create class Solution with main method. Implement 2 Static methods- getLowestScoredStudentByCollegeName and getSecondHighestScoredStudent getLowestScoredStudentByCollegeName method:   The method will take array of Student objects and a String value as  input parameters and return the Student with lowest score from array of Student objects for the given collegeName.(String parameter passed).   If no student with above condition is present in  the array of Student objects,then the method should return null.  The main method should print the studentId,studentName,score,collegeName on separate lines from the returned Student object if the returned value is  not null. If the returned value is null then main method should print "No such student found". getSecondHighes