Create a class called myYear which includes the information below: (a) Two integer private instance variables called month and year. (b) A constructor to initialize both instance variables. (c) Getters and setters for both instance variables. (d) A method called displayYear to display variable month and year separated by “/”. (e) A test class called testYear to create instance of class myYear. In the main method, (i) Initialize myYear with 9 for month and 2020 for year. (ii) Prompt values for both variables. (iii) Call setter methods and assign values from (ii) as arguments. (iv) Call method displayYear
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question 5 ( java progrmming)
Create a class called myYear which includes the information below:
(a) Two integer private instance variables called month and year.
(b) A constructor to initialize both instance variables.
(c) Getters and setters for both instance variables.
(d) A method called displayYear to display variable month and year separated by “/”.
(e) A test class called testYear to create instance of class myYear. In the main method,
(i) Initialize myYear with 9 for month and 2020 for year.
(ii) Prompt values for both variables.
(iii) Call setter methods and assign values from (ii) as arguments.
(iv) Call method displayYear.
Step by step
Solved in 3 steps with 2 images