Question: Write a Java program to develop a class Student with the following specifications: The class has two instance variables: name (of type string) and

Write a Java program to develop a class Student with the following specifications: The class has two instance The class has a two-argument constructor that sets the values of its instance variables to given values. The

Write a Java program to develop a class Student with the following specifications: The class has two instance variables: name (of type string) and age of type integer. Print out your name. The class has a method called calage() which must add 2 years to your age for example if your age is 18 The output is 20 Convert calage() method to the constructor What is the difference between Method and Constructor? Exercise 2: 1. Write a Java program to develop a class Employee with the following specifications: The class has two private instance variables: name (of type string) and id (of type integer) The class has a two-argument constructor that sets the values of its instance variables to given values. The class has a two-argument constructor that sets the values of its instance variables to given values. The class has public getter and setter methods for each of the instance variables. Print out the value of name and id. Run exercise 1 and 2 in NetBean and send a

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Student Class public class Student Attributes String name int age public Student default co... View full answer

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 Programming Questions!