first commit
This commit is contained in:
87
Semester 1/Programming 1/Homework 3/Holiday.java
Normal file
87
Semester 1/Programming 1/Homework 3/Holiday.java
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
/**
|
||||
* Write a description of class Holiday here.
|
||||
*
|
||||
* @George Wilkinson
|
||||
* @3/11/23
|
||||
*/
|
||||
public class Holiday
|
||||
{
|
||||
// Create a String variable to hold the reference number.
|
||||
private String refNumber;
|
||||
|
||||
// Create a String variable to hold the type of holiday.
|
||||
private String type;
|
||||
|
||||
// Create an integer variable to hold the price in pounds of the holiday.
|
||||
private int price;
|
||||
|
||||
/**
|
||||
* Default constructor for objects of class Holiday
|
||||
*/
|
||||
public Holiday()
|
||||
{
|
||||
// initialise instance variables
|
||||
refNumber = "W001";
|
||||
type = "beach";
|
||||
price = 300;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for objects of class Holiday.
|
||||
*/
|
||||
public Holiday( String refNumber, String type, int price )
|
||||
{
|
||||
this.refNumber = refNumber;
|
||||
this.type = type;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reference number of the holiday.
|
||||
*/
|
||||
public String getRefNumber()
|
||||
{
|
||||
return refNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the holiday.
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the price of the holiday.
|
||||
*/
|
||||
public int getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reference number of the holiday to a new value.
|
||||
*/
|
||||
public void setRefNumber( String refNumber )
|
||||
{
|
||||
this.refNumber = refNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of the holiday to a new value.
|
||||
*/
|
||||
public void setType( String type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the price of the holiday to a new value.
|
||||
*/
|
||||
public void setPrice( int price )
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user