Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The assessment tool is aligned to the following module SLOs: - develop programming style and documentation Using the program in Programming below, add comments to
The assessment tool is aligned to the following module SLOs:
- develop programming style and documentation
Using the program in Programming below, add comments to the lines that print your full name, major and classification.
After you make your changes, execute the program and verify the contents of the output. Download the program and save it to your computer.
Upload to the dropbox below.
public class Puppy {
int puppyAge;
public Puppy(String name) {
// This constructor has one parameter, name.
System.out.println("Name chosen is :" + name ); }
public void setAge( int age )
{
puppyAge = age;
}
public int getAge( ) {
System.out.println("Puppy's age is :" + puppyAge ); return puppyAge; }
public static void main(String []args) {
/* Object creation */
Puppy myPuppy = new Puppy( "tommy" );
/* Call class method to set puppy's age */
myPuppy.setAge( 2 );
/* Call another class method to get puppy's age */
myPuppy.getAge( );
/* You can access instance variable as follows as well */
System.out.println("Variable Value :" + myPuppy.puppyAge ); }
}
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