DreamTek Company Program in java

In this post, we will learn DreamTek Company Program in java Programming language.

Question:

DreamTek Company provides an initial training for all its employees, once they join the company. During the training phase they call the employees as “Associate”. The initial training is conducted for 60 days for each Associate. In these 60 days they learn various technologies. The first 20 days they learn “Core skills”, the next 20 days they learn “Advanced modules” and the final 20 days they go to the “Project phase”.  Help the DreamTek Company to find in which phase the associates are in.

Consider the below class:

DreamTek Company Program in java

In the Associate class include the given attributes and methods with the access specifiers as specified in the class diagram.

The setter methods are used to set the value and the getter methods are used to retrieve the value.

The trackAssociateStatus method takes the number of days as argument and sets the work status of the associate based on the number of days. If the number of days is greater than 60 days then set the work status as “Deployed in project”.

 In the Main class, create an object for the Associate class; Get the details as shown in the sample input and assign the value for its attributes using the setters. Invoke the trackAssociateStatus method and find the work status and display the details as shown in the sample output.

Sample Input1:

Enter the associate id:

123

Enter the associate name:

john

Enter the number of days:

45

 Sample Output 1:

The associate john work status:Project phase

 Sample Input 2:

Enter the associate id:

124

Enter the associate name:

ram

Enter the number of days:

70

 Sample Output 2:

The associate ram work status:Deployed in project

CODE:

import java.util.Scanner;
public class Main{
    public static void main (String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter the associate id:");
        int ass_Id=sc.nextInt();
        sc.nextLine();
        System.out.println("Enter the associate name:");
        String name=sc.nextLine();
        System.out.println("Enter the number of days:");
        int days=sc.nextInt();
        Associate obj=new Associate();
        obj.setAssociateName(name);
        obj.trackAssociateStatus(days);
        System.out.println("The associate "+obj.getAssociateName()+" work status:"+obj.getWorkStatus());
    }
}
public class Associate{
    private int associateId;
    private String associateName;
    private String workStatus;
    public int getAssociateId()
    {
        return this.associateId;
    }
    public void setAssociateId(int associateId)
    {
        this.associateId=associateId;
    }
    public String getAssociateName()
    {
        return this.associateName;
    }
    public void setAssociateName(String associateName)
    {
        this.associateName=associateName;
    }
    public String getWorkStatus()
    {
        return this.workStatus;
    }
    public void setWorkStatus(String workStatus)
    {
        this.workStatus=workStatus;
    }
    public void trackAssociateStatus(int days)
    {
        //days=abs(days);
        if(days>=1&&days<=20)
        {
            this.setWorkStatus("Core skills");
        }
        else if(days>=21 && days<=40)
        {
            this.setWorkStatus("Advanced modules");
        }
        else if(days>=41 && days<=60)
        {
            this.setWorkStatus("Project phase");
        }
        else
        {
            this.setWorkStatus("Deployed in project");
        }
    }
}
Next:
  1. ZeeZee bank
  2. Book Detail
  3. Ticket Price Calculate – Static
  4. Student Details – Constructor
Sharing Is Caring

Leave a Comment