Write a program to create a room class, the attributes of this class is roomno, roomtype, roomarea and ACmachine. In this class the member functions are setdata and displaydata.

 /*

Write a program to create a room class, the attributes of this class is roomno, roomtype, roomarea and ACmachine. In this class the member functions are setdata and displaydata.

*/

class Room

{       

    int roomno;

    String roomtype;

    float roomarea;

    boolean ACmachine;

    void setdata(int no,String type,float area,boolean ac)

    {

        roomno = no;

        roomtype = type;

        roomarea = area;

        ACmachine = ac;

    }

    void displaydata()

    {

        System.out.println("Room Number Is : " + roomno);

        System.out.println("Room Type Is : " + roomtype);

        System.out.println("Room Area Is : " + roomarea);

        String machine = (ACmachine) ? "Yes" : "No";

        System.out.println("AC available : " + machine);

    }

}

class Twentyfour

{   

    public static void main(String args[])

    {

        Room obj = new Room();

        obj.setdata(8,"Duplex",101.20f,false);

        obj.displaydata();

    }    

}

More Information on our channel Programmer Community

please like , share and subscribe to get notifications of new videos....

To understand this program video will coming soon on our you tube channel



Comments

Popular posts from this blog

Design and Develop a java program to read marks of a student and print the total and average of marks using scanner class.

Write a Java program to convert seconds to hour, minute and seconds.

Write a Java program to print the ascii value of a given character.