Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the Contestant class, complete the public method definition for setAge ( ) with the integer parameter customAge. Ex: If the input is Minenhle 7
In the Contestant class, complete the public method definition for setAge with the integer parameter customAge.
Ex: If the input is Minenhle then the output is:
Name: Minenhle
Number of points:
Age: public class Contestant
private String name;
private int numPoints;
private int age;
public void setNameString customName
name customName;
public void setNumPointsint customNumPoints
numPoints customNumPoints;
Your code goes here
age customAge;
public String getName
return name;
public int getNumPoints
return numPoints;
public int getAge
return age;
import java.util.Scanner;
public class ContestantAccess
public static void mainString args
Scanner scnr new ScannerSystemin;
Contestant contestant new Contestant;
String userName;
int userNumPoints;
int userAge;
userName scnrnext;
userNumPoints scnrnextInt;
userAge scnrnextInt;
contestantsetNameuserName;
contestantsetNumPointsuserNumPoints;
contestantsetAgeuserAge;
System.out.printlnName: contestantgetName;
System.out.printlnNumber of points: contestantgetNumPoints;
System.out.printlnAge: contestantgetAge;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started