Skip to main content

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

 Problem Statement : 





Subscribe Please : click here         Subscribe Please : click here

                        


Create a class Course with the below attributes:

String courseName;

String instructor;

int studentAttend;

boolean present;

String city ;

Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence .

Create class Solution with main method. Implement one static methods – findCategory in Solution class.  

                                                   Subscribe Please : click here

findCategory method : 

This method will take two input parameters -array of Course objects and string parameter name i.e courseName. The method will return the the String value that is Category on the basis of below condition .

If studentAttend present less than 1500 and greater than equals to 1000 then category is "Diamond" .

If studentAttend present less than 1000 and greater than equals to 500 then category is "Golden" .

If studentAttend present less than 500  then category is "Silver".

If no Course with the given courseName is present in the array of Course objects, then the method should return null.

If the returned value is null then it should print “No match found".

but if any matches then return the category as per above condition .


Thank You !

   Subscribe Please : click here             Subscribe Please : click here

Code : 

import java.util.Scanner;

class Course{
    //Attribute declare
    String nm;
    String ins;
    int attend;
    boolean present;
    String city ;

    public Course(String nm,String ins,int attend,boolean present,String city){
        this.nm=nm;
        this.ins=ins;
        this.attend=attend;
        this.present=present;
        this.city=city;

    }

}
public class Solution{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        Course arr[]=new Course[4];

        for(int i=0;i<arr.length;i++){
            String a=sc.nextLine();
            String b=sc.nextLine();
            int c=sc.nextInt();
            sc.nextLine();
            boolean d=sc.nextBoolean();
            String e= sc.nextLine();

            arr[i]=new Course(a,b,c,d,e);
        }
        String str=sc.nextLine();
        String result=find(arr, str);

        if(result==null){
            System.out.println("No match found");
        }
        else{
            System.out.println(result);
        }
       
    }

    public static String find(Course arr[],String str){
        String cat="";
        for(int i=0;i<arr.length;i++){
            if(arr[i].nm.equalsIgnoreCase(str)){
                if(arr[i].attend<1500 && arr[i].attend>=1000){
                    cat+="Diamond";
                    return cat;
                }
                if(arr[i].attend<1000 && arr[i].attend>=500){
                    cat+="Golden";
                    return cat;
                }
                if(arr[i].attend<500 ){
                    cat+="Silver";
                    return cat;
                }
            }
        }
        return null;
    }
}


Subscribe Please : click here              Subscribe Please : click here


Comments

Popular posts from this blog

Complete Strategy to clear TCS Xplore IPA in One Attempt Now ( 80+ Score )

  So hello Everyone , Here are the all Links from where you can Practice !  All the resources are searched from my best !  1. For KYT and Bizzskill  Link :- tcs Xplore course  2. Unix Operating system Link :-    a.  click here Link 1 b.  click here Link 2 c.  Click here Link 3   3. UI  Link :-  click here 4. SQL and Pl SQL Link : -  Click here Click here click here 5. Java MCQ  Link :-  click here click here click here 6. Java coding :-  Access the playlist on YouTube :-  click here to watch Access the blogs :-  click here All in one link :-   click here

TCS IPA previous year quistion ( 35 marks ) , Quistion , Input , output

 Problem Statement Video Link :    https://youtu.be/XCBvfJAo908 Create a class TravelAgencies with below attributes: regNo – int agencyName – String pakageType – String price – int flightFacility – boolean Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence. Create class Solution with main method. Implement two static methods – findAgencyWithHighestPackagePrice and agencyDetailsforGivenIdAndType in Solution class. findAgencyWithHighestPackagePrice method: This method will take array of TravelAgencies objects as an input parameter and return the highest package price from the given array of objects. agencyDetailsForGivenldAndType method: This method will take three input parameters -array of TravelAgencies objects, int parameter regNo and String parameter packageType. The method will return the TravelAgencies object based on below conditions. FlightFacility should be available. The input parameters(regNo and pack...

TCS Xplore 2023 - JAVA MCQ question for best practice ( iON Proctored Assessment )

           Multiple Choice Question ( JAVA )     ---------------------->>>>    Click Here : Subscribe to click   <<<<< -------------------------- PART - 01  Q1 . What is size of float and double ?         a.  32 and 64                      b. 32 and 32          c.  64 and 64                      d. 64 and 32  Ans : 32 and 64  Q2 .  What will be the output ?            short x=10;           x*=5;           System.out.println(x);         a.  50                                b. 10         c.  No output    ...