Question: java solve Define a class and name it as ICPCVolunteer. Add the following inside the class. 2/4 1. Define instance variables name, role, rank 2.

 java solve Define a class and name it as "ICPCVolunteer". Add

java solve

Define a class and name it as "ICPCVolunteer". Add the following inside the class. 2/4 1. Define instance variables name, role, rank 2. Add a parameterized constructor which will take 3 parameters for the 3 attributes. Inside the constructor initializes the respective attributes with the parameters passed to the constructor. 3. Add the following methods. a. public void getTraining(String trainingName, int score) - Inside the method, increase the rank by score amount and print "name attended trainingName training.". Here name and rank are instance variables where as trainingName and score are the values of the parameters passed to the method. b. public int getRank() - the method should return the rank attribute. c. public void display() - inside the method, print the value of all three attributes. Question 2: [8] Define a class and name it as "ICPCContest". Define the main method inside the class. Inside the main, do the following. 1. Create an object of ICPCVolunteer class name=your name, role = "registration", and rank =2. Store the reference to a variable name volunteer. 2. Call the getTraining(...) method using the volunteer variable and pass "Meet and Greet" and 3 as the parameters of the method. 3. Call the display(...) method using the volunteer. - What is the output of this method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!