Description
Lab Exercise #3 – Classes
1. Write a program that uses methods in a class in Java
• Write a class called OurDate that consists of:
o three instance variables – a month, a day and a year (each of type int).
o an initial constructor and assumes the parameter values are correct.
o a displayDate method that displays the month/day/year (separated by forward slashes)
• Write a test application names DateTest (with method main) that demonstrates class OurDate’s capabilities) See sample below.
Sample program output: (user input is in red, program display in blue)
Enter a month: 6
Enter a day: 3 Enter a year: 2013
Another Sample program output
Enter a month: 12 Enter a day: 31 Enter a year: 2011
CST8110 – Lab Exercise 3 – Classes 1 of 1
Reviews
There are no reviews yet.