Skip to main content

Posts

30 January 2022 CPA, prime management JAVA solution.

Question: Create the class PrimeManagement with the below attributes: primeId-int  userProfileName-String subscriptionType-String subscriptionPrice-double noOfProfiles-int The above attributes should be private,write getter and setter and  parameterized constructor as required. Create class MyClass with main method. Implement a static method-findAvgPriceByType in MyClass class. findAvgPriceByType method:     This method will take two input parameters-array of PrimeManagement  objects and String parameter.This method will return average Subscription  price (as int value) from array of PrimeManagement objects for given  subscription type(String parameter passed) and whose noOfProfiles is greater than 3.       If no PrimeManagement with above condition is present in array of  PrimeManagement objects,then the method should return 0.      The main method should print the returned average subscription price  of PrimeManagement as it is ,if the returned value is greater than 0,or it  should p

December 23 java coding question PRA solution

23 dec pra java coding question solution. Question: Create the class Student with below attributes. id-int name-String marks-int age-int write getters and setters and parametrized constructor in Student class. Create class Solution with main method. implement 2 static methods-findStudentWithMaximumAge and searchStudentById in Solution class. findStudentWithMaximumAge method:     This method will take the Array of the Students objects as input and  returns the Student object having maximum Age.   For this method,the main method should print the student object details with maximum age as it is.    searchStudentById method:     This method will take 2 input parameters.Array of the Students objects and an int value  id.and returns the Student object having the mentioned id  if found, else return null if not found.   For this method ,main method should print the details of Student objects  as it is,if the returned value is not null. or it should print  "No Student found with mentioned

tcs ira 29November 2021 java coding question solution.

 Question: Create the class Bank with below Attributes. bankId-int bankName-String numberOfCustomers-int city-String  write parametrized constructor as well in Bank Class. Create class Solution  with main method. Implement 2 Static methods-findAvgNumberOfCustomersByCity and  getSecondLowestNumberOfCustomersBank in Solution class. findAvgNumberOfCustomersByCity method-This method will take two input parameters.Array of Bank Objects and String Parameter city and will return the average number of customers of bank from array of Bank Objects for the  given city.    If no banks with given city present inside the array of the Bank Objects, then the method should return 0. The main method should print the average of the number of Customers if the  returned value is greater than 0.Else main method will print "Bank not Found". getSecondLowestNumberOfCustomersBank method- This method will take 1 input  Parameter that is Array of Bank Objects and return Bank Object having the  second lo

28 june 2021 2 pm java question solution.

import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc= new Scanner(System. in ); System. out .println( "Enter Member Id" ); int a=sc.nextInt(); sc.nextLine(); System. out .println( "Enter Name" ); String b=sc.nextLine(); System. out .println( "Enter Member Type" ); String c=sc.nextLine(); ClubMember clubMember= new ClubMember(a,b,c); calculateMembershipFees (clubMember); } public static void calculateMembershipFees(ClubMember clubMember) { if (clubMember.getMemberType().equalsIgnoreCase( "Gold" )) { clubMember.setMembershipFees( 50000 ); } else if (clubMember.getMemberType().equalsIgnoreCase( "Premium" )) { clubMember.setMembershipFees( 75000 ); } System. out .println( "Member Id is

june 26 cpa 2.30 pm

 code:   import java.util.Arrays; import java.util.Scanner; public class cpa26june230pm {     public static void main(String[] args) {         Scanner sc=new Scanner(System.in);         Painting[] paintings=new Painting[4];         for (int i = 0; i <paintings.length ; i++) {             int a=sc.nextInt();             sc.nextLine();             String b=sc.nextLine();             String c=sc.nextLine();             int d=sc.nextInt();             sc.nextLine();             String e=sc.nextLine();             paintings[i]=new Painting(a,b,c,d,e);         }         String inputType=sc.nextLine();         String inputName=sc.nextLine();         double ans1=findAvgpriceForGivenType(paintings,inputType);           if(ans1==0.0)           {               System.out.println("No such painting for the given type");           }           else           {               System.out.println(ans1);           }       Painting[]  ans2   =findByGivenName(paintings,inputName);           if(

june 26 cpa 9.00 am solution.

 code:     import java.util.Arrays; import java.util.Scanner; public class cpa26june9am {     public static void main(String[] args) {         Scanner sc=new Scanner(System.in);         Goods[] goods=new Goods[4];         for (int i = 0; i <goods.length ; i++) {             int a=sc.nextInt();             sc.nextLine();             String b=sc.nextLine();             double c=sc.nextDouble();             sc.nextLine();             String d=sc.nextLine();             goods[i]=new Goods(a,b,c,d);         }         String input1=sc.nextLine();        int ans1= countGoodsByBrand(goods,input1);         if(ans1>0)         {             System.out.println(ans1);         }         else         {             System.out.println("No such goods for required brand available");         }        Goods ans2 =getSecondHighestPriceGoods(goods);         if(ans2==null)         {             System.out.println("No such goods available");         }         else         {           

june 12 tcs cpa java coding question.

Create a class song with the below attributes. songId=int title=String artist=String duration=double the above attributes should be private  write getter and setter and parametrized constructor as required . create class cpa12june with main method. Implement two static methods -  findSongDurationForArtist and getSongsInAscendingOrder in cpa12june class. findSongDurationForArtist method- this method will take two input parameters -array of Song objects and String parameter. The method will  return the sum of the song duration from the array of the Song objects for the given artists(Sttring 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 2 input parameters-array of the  Song objects and the String parameter. this method will return Song object array in an ascending order of their duration ,from the array of Song objects whose artist attribute matche