First Java Programming Assignment !

Here’s our first semester Programming Assignment of our College which was to build a system to book a Tourist Guide.

Here is the code.


/**
*
* Class represent the TourGuide for Tourist
*
*
* Here is the class stores tour guide detail, tourist detail, destination
* hire date, number of days, daily rate, down payment and availeble status
* of a tourist guide.
*
*@author(Nare)
*
*@version(17/12/2014)
*
*/

public class TourGuide
{

/* Setting all given attributes */
private String tourGuide;
private String customerName;
private String tourDestination;
private int hireDate;
private int noOfDays;
private int dailyRate;
private int downPayment;
private boolean availebleStatus ;

/*
* constructor for an object of class TourGuide and passing parameters to it.
*/

public TourGuide(String tour_guide_name, int daily_rate)
{

tourGuide = tour_guide_name;
dailyRate = daily_rate;
customerName = “”;

tourDestination = “”;
downPayment = 0;
noOfDays = 0 ;
availebleStatus = true;

}

/** Method for getting tour guide detail**/
public String getTourGuide(){

return tourGuide;

}
/** Method for getting customer name**/
public String getCustomerName(){
return customerName;

}

/** Method for getting hire date of tour guide **/
public int getHireDate(){

return hireDate;
}

/** Method for getting daily rate of the tour guide **/
public int getdailyRate(){

return dailyRate;
}

/** Method for getting hide days of tour guide **/
public int getnoofDays(){

return noOfDays;
}

/** Method for getting down payment of tour guide **/
public int getDownPayment(){

return downPayment;
}

/** Method for getting tour destination **/
public String gettourDestination(){

return tourDestination;
}

/** Method for getting available status**/
public boolean getAvailableStatus(){

return availebleStatus;
}

/** Method for setting Daily rate of the tour guide. **/
public void setDailyRate(int d_rate){

dailyRate = d_rate;

}

/** Method for setting tour destination**/
public void setTourDestination(String tour_dest)
{

tourDestination = tour_dest;

}
/** Method for booking the tour guide and finding if tour guide is available or not**/
public void Booking(String tourist_name, int tourdate, String tour_destination, int total_tour_date, int down_pay ){

if ( availebleStatus == false){

/** Providing an appropriate message when tour guide is not available **/
System.out.println(“The tour guide has been hired on” + hireDate + “he would be free after ” + noOfDays);

}

else {

/** Tour guide is available and information being updated by the paraments **/
customerName = tourist_name;
hireDate = tourdate;
tourDestination = tour_destination;
noOfDays = total_tour_date;
downPayment = down_pay;

availebleStatus = false;

}

}

/** Method for making tour guide avaiable **/

public void FreeTourGuide(){

if( availebleStatus==true){

//** Appropriate message is being displayed when trour guide already free.**/
System.out.println(“Tourist Guide is aready Free.”);

}

else {
/** Tour guide is not free and setting the tourist information and making tour guide available **/
customerName = “”;
hireDate = 0;
noOfDays = 0;
tourDestination = “”;
downPayment = 0;
availebleStatus = true;
}

}

/** Method for Displaying the Tour Guide Description **/

public void Description(){

System.out.println(” The tourist name is “+ tourGuide);
System.out.println(” The daily rate of the Tour Guide is”+ dailyRate);

} /** End of the main class TourGuide **/

}

 

Comments

There are no comments.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>