Question
in Java, 39) Code a constructor for the Date described below. The constructor has three arguments: public class Date { private int month; // 1-12
in Java,
39) Code a constructor for the Date described below. The constructor has three arguments:
public class Date
{
private int month; // 1-12
private int day; // 1-31 based on month
public int Year ;
// constructor: use property Month to confirm proper value for month;
// use property Day to confirm proper value for day
}
40. Given the class Vector3 as coded below and the constructor Vector3 with the header shown. Demonstrate the use of this keyword within the constructor code?
class Vector3
{
float x;
float y;
float z;
public Vector3 (float x, float y, float z)
Answer
public Vector3 (float x, float y, float z)
{
//put your answer here
}
}
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