/**
Creating project3Morris class
*/
//Fields
public class Project3Morris
{
private int vacantRooms;
private int numBuildings;
private int numRoomsFloor;
private int totalRooms;
private int numOccupiedRooms;
private double occupancyRate;
private int numFloors;
}
//Constructor to accept arguments from user input
public Project3Morris(int nB, int nF, int nRF, int nOR)
{
numBuildings=nB;
numFloors=nF;
numRoomsFloor=nRF;
numOccupiedRooms=nOR;
}
/**
Set numBuilding method sets the number of buildings
@param nB The number of buildings
*/
public void setNumBuidings(int nB)
{
numBuildings=nB;
}
/**
Set numFloors method sets the number of floors
@param nF The number of floors
*/
public void setNumFloors(int nF)
{
numFloors=nF;
}
/**
Set numRoomsFloor method to set num of rooms per floor
@param nRF The number of rooms per floor
*/
public void setNumRoomsFloor(int nRF)
{
numRoomsFloor=nRF;
}
/**
Set numOccupiedRooms method to set the number of occupied rooms
@param nOR The number of occupied rooms
*/
public void setNumOccupiedRooms(int nOR)
{
numOccupiedRooms=nOR;
}
/**
getnumBuildings method
@return The number of buildings
*/
public int getNumBuildings()
{
return numBuildings;
}
/**
getnumFloors method
@return The number of floors
*/
public int getNumFloors()
{
return numFloors
}
/**
getnumRoomsFloor method
@return The number of rooms per floor
*/
public int getNumRoomsFloor()
{
return numRoomsFloor
}
/**
getnumOccupiedRooms method
@return The number of occupied rooms
*/
public int getNumOccupiedRooms()
{
return numOccupiedRooms
}
/**
getvacantRooms method
@return The product of numRoomsFloor minus numOccupiedRooms
*/
public int getVacantRooms()
{
return numRoomsFloor - numOccupiedRooms;
}
/**
getOccupancyRate method
@return The product of numOccupiedRooms divided by numRoomsFloor
*/
public double getOccupancyRate()
{
return numOccupiedRooms / numRoomsFloor;
}
/**
gettotalRooms method
@return The product of numFloors * numRoomsFloor
*/
public int getTotalRooms()
{
return numFloors * numRoomsFloor;
}
/**
gettotalOccupiedRooms method
@return The product of numOccupiedRooms * numRoomsFloor
*/
public int getTotalOccupiedRooms()
{
return numOccupiedRooms * numRoomsFloor
}
}
__________________________________________________ __________________________________________________
Project3Morris.java:23: error: class, interface, or enum expected
public Project3Morris(int nB, int nF, int nRF, int nOR)
^
Project3Morris.java:26: error: class, interface, or enum expected
numFloors=nF;
^
Project3Morris.java:27: error: class, interface, or enum expected
numRoomsFloor=nRF;
^
Project3Morris.java:28: error: class, interface, or enum expected
numOccupiedRooms=nOR;
^
Project3Morris.java:29: error: class, interface, or enum expected
}
^
Project3Morris.java:36: error: class, interface, or enum expected
public void setNumBuidings(int nB)
^
Project3Morris.java:39: error: class, interface, or enum expected
}
^
Project3Morris.java:46: error: class, interface, or enum expected
public void setNumFloors(int nF)
^
Project3Morris.java:49: error: class, interface, or enum expected
}
^
Project3Morris.java:56: error: class, interface, or enum expected
public void setNumRoomsFloor(int nRF)
^
Project3Morris.java:59: error: class, interface, or enum expected
}
^
Project3Morris.java:66: error: class, interface, or enum expected
public void setNumOccupiedRooms(int nOR)
^
Project3Morris.java:69: error: class, interface, or enum expected
}
^
Project3Morris.java:76: error: class, interface, or enum expected
public int getNumBuildings()
^
Project3Morris.java:79: error: class, interface, or enum expected
}
^
Project3Morris.java:86: error: class, interface, or enum expected
public int getNumFloors()
^
Project3Morris.java:96: error: class, interface, or enum expected
public int getNumRoomsFloor()
^
Project3Morris.java:106: error: class, interface, or enum expected
public int getNumOccupiedRooms()
^
Project3Morris.java:116: error: class, interface, or enum expected
public int getVacantRooms()
^
Project3Morris.java:119: error: class, interface, or enum expected
}
^
Project3Morris.java:126: error: class, interface, or enum expected
public double getOccupancyRate()
^
Project3Morris.java:129: error: class, interface, or enum expected
}
^
Project3Morris.java:136: error: class, interface, or enum expected
public int getTotalRooms()
^
Project3Morris.java:139: error: class, interface, or enum expected
}
^
Project3Morris.java:146: error: class, interface, or enum expected
public int getTotalOccupiedRooms()
^
25 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
__________________________________________________ __________________________________________________
//Create an instance of project3Morris
//passing the data that was entered as arguments
//to the constructor
Project3Morris number = new Project3Morris(buildNum, floorNum, roomFloor, occupiedRooms);