1- class Room { //Member variables 3 int roomno; 4 String roomtype; 5 float roomrarea; 6 boolean ACmachine; 7 8 //Member Function setData 9- void setdata(int rnumber, String rtype, float rarea, boolean checkAC) { //Setting the data rnumber; 10 11 roomno = 12 roomtype = rtype; roomrarea = rarea; ACmachine = checkAC; 13 14 15 } 16 17 //Member function to display data 18 - void displaydata() { AT System.out.println("Room No: System.out.println("Room Type: System.out.println("Room area: String flag = (ACmachine) ? "yes ": "no "; System.out.println("Ac required ? " + flag); + roomno); + roomtype); + roomrarea); 19 20 21 22 23 24 } 25 26 //Main Program 27 - public static void main(String arg[]) {| 28 29 //Room object Room myRoom = new Room(); Room myRoom2 = new Room(); Room myRoom3 = new Room(); 30 31 32 33 34 35 //Call the methods myRoom.setdata(10, "Villa", 1000f, false); myRoom2.setdata(11, "Villa", 1200f, true); myRoom3.setdata(12, "Villa", 1400f, false); myRoom.displaydata(); myRoom2.displaydata(); myRoom3.displaydata(); 36 37 38 39 40 41 42 43 } 44 }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Explain in detsil each and every line by line plz. The code of java .....

 

1- class Room {
//Member variables
3 int roomno;
4 String roomtype;
5 float roomrarea;
6 boolean ACmachine;
7
8 //Member Function setData
9- void setdata(int rnumber, String rtype, float rarea, boolean checkAC) {
//Setting the data
roomno = rnumber;
roomtype = rtype;
10
11
12
13
roomrarea
rarea;
14
ACmachine = checkAC;
15 }
16
17 //Member function to display data
18 - void displaydata() {
System.out.println("Room No: " + roomno);
System.out.println("Room Type:
System.out.println("Room area:
String flag = (ACmachine) ? "yes ": "no ";
System.out.println("Ac required ?
19
+ roomtype);
+ roomrarea);
20
21
22
23
+ flag);
24 }
25
26 //Main Program
27 - public static void main(String arg[]) {|
28
29 //Room object
Room myRoom = new Room();
Room myRoom2 = new Room();
Room myRoom3 = new Room();
30
31
32
33
34
35 //Call the methods
myRoom.setdata(10, "Villa", 1000f, false);
myRoom2.setdata(11, "Villa", 1200f, true);
myRoom3.setdata(12, "Villa", 1400f, false);
myRoom.displaydata();
myRoom2.displaydata();
myRoom3.displaydata();
36
37
38
39
40
41
42
43 }
}
44
Transcribed Image Text:1- class Room { //Member variables 3 int roomno; 4 String roomtype; 5 float roomrarea; 6 boolean ACmachine; 7 8 //Member Function setData 9- void setdata(int rnumber, String rtype, float rarea, boolean checkAC) { //Setting the data roomno = rnumber; roomtype = rtype; 10 11 12 13 roomrarea rarea; 14 ACmachine = checkAC; 15 } 16 17 //Member function to display data 18 - void displaydata() { System.out.println("Room No: " + roomno); System.out.println("Room Type: System.out.println("Room area: String flag = (ACmachine) ? "yes ": "no "; System.out.println("Ac required ? 19 + roomtype); + roomrarea); 20 21 22 23 + flag); 24 } 25 26 //Main Program 27 - public static void main(String arg[]) {| 28 29 //Room object Room myRoom = new Room(); Room myRoom2 = new Room(); Room myRoom3 = new Room(); 30 31 32 33 34 35 //Call the methods myRoom.setdata(10, "Villa", 1000f, false); myRoom2.setdata(11, "Villa", 1200f, true); myRoom3.setdata(12, "Villa", 1400f, false); myRoom.displaydata(); myRoom2.displaydata(); myRoom3.displaydata(); 36 37 38 39 40 41 42 43 } } 44
ull3 KB/S
A 23%
11:22 PM
11:22 PM
GBWhatsApp
GBWhatsApP
7/168
Main.java
1- class Mobile{
string brand, color;
int camera;
3
4
7- void setdata(String sbrand, String scolor, int scamera) {
//Setting the data
brand = sbrand;
color = scolor;
camera = scamera;
}
8
9.
10
11
12
13
void displaydata() {
System.out.println("Alex own " + brand);
System.out.println("Smartphone of having colour
System.out.println("and camera of " + camera +
}
14 -
15
+ color);
MP");
16
17
18
19 - public static void main(string args[]) {
20
21 //object created
Mobile alex
= new Mobile();
Mobile rio = new Mobile();
Mobile raphael = new Mobile();|
22
23
24
25
26
alex.setdata("iPhone","Gold",8);
rio.setdata("Samsung","White",13);
raphael.setdata("Nexus","Black",8);
alex.displaydata();
rio.displaydata();
raphael.displaydata();
27
28
29
30
31
32
33
34
}
35 }
+)
Send
Set as
Add to
Edit
Delete
Transcribed Image Text:ull3 KB/S A 23% 11:22 PM 11:22 PM GBWhatsApp GBWhatsApP 7/168 Main.java 1- class Mobile{ string brand, color; int camera; 3 4 7- void setdata(String sbrand, String scolor, int scamera) { //Setting the data brand = sbrand; color = scolor; camera = scamera; } 8 9. 10 11 12 13 void displaydata() { System.out.println("Alex own " + brand); System.out.println("Smartphone of having colour System.out.println("and camera of " + camera + } 14 - 15 + color); MP"); 16 17 18 19 - public static void main(string args[]) { 20 21 //object created Mobile alex = new Mobile(); Mobile rio = new Mobile(); Mobile raphael = new Mobile();| 22 23 24 25 26 alex.setdata("iPhone","Gold",8); rio.setdata("Samsung","White",13); raphael.setdata("Nexus","Black",8); alex.displaydata(); rio.displaydata(); raphael.displaydata(); 27 28 29 30 31 32 33 34 } 35 } +) Send Set as Add to Edit Delete
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY