Lab Exercise #3 – Classes solution

$9.99

Original Work ?

Download Details:

  • Name: Lab3.zip
  • Type: zip
  • Size: 21.31 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

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 a default constructor that initializes the three instance variable to January 1, 1901. 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) Initial date is 1/1/1901 Enter a month: 6 Enter a day: 3 Enter a year: 2013 Date is 6/3/2013
Another Sample program output Initial date is 1/1/1901 Enter a month: 12 Enter a day: 31 Enter a year: 2011 Date is 12/31/2011