In my driver tester program I'm trying to get the toInfo method to print, but I'm getting
'void' type not allowed here when trying to compile the HotelTester program, please offer help, TIA.
public class HotelTester
{
public static void main(String[] args)
{
Room room = new Room("Smith", 2, 2, 29.99,10);
System.out.println(room.getNumBeds());
System.out.println(room.toInfo());
}
}
####
This is my class:
/**
Attributes of a hotel room
*/
public class Room
{
private String guest;
private int number;
private int numBeds;
private double rate;
private int numOfDays;
/**
Constructs a guest room..
@param guest Last Name of guest.
@param number
*/
public Room(String guestName, int roomNumber, int howManyBeds, double dailyRate, int howManyNights )
{
guest = guestName;
number = roomNumber;
numBeds = howManyBeds;
rate = dailyRate;
numOfDays = howManyNights;
}
/**
Gets the last name of the guest..
@return the last name
*/
public String getGuest()
{
return guest;
}
public int getNumber()
{
return number;
}
public int getNumBeds()
{
return numBeds;
}
public int getNumOfDays()
{
return numOfDays;
}
/**
Input the guest's name.
@param guest is the name of the guest.
*/
public void setGuest(String guestName)
{
guest = guestName;
}
/**
Inputs the room number.
@param number is the room number..
*/
public void setNumber(int roomNumber)
{
number = roomNumber;
}
/**
Inputs the number of bed.
@param numBeds is the number of beds..
*/
public void NumBeds(int howManyBeds)
{
numBeds = howManyBeds;
}
/**
Inputs the rate.
@param rate is the daily rate.
*/
public void setRate(double dailyRate)
{
rate = dailyRate;
}
/**
Inputs the rate.
@param rate is the daily rate.
*/
public void setnumOfDays(int howManyNights )
{
numOfDays = howManyNights;
}
public void toInfo ()
{
System.out.println(getGuest());
}
}
This post has been edited by macosxnerd101: 17 November 2010 - 08:27 AM
Reason for edit:: Please use code tags.

New Topic/Question
Reply




MultiQuote








|