-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphone.java
53 lines (45 loc) · 1.46 KB
/
phone.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.*;
class phone {
double width, height, price;
String os, brand;
phone(double width, double height, double price, String os, String brand) {
this.width = width;
this.height = height;
this.price = price;
this.os = os;
this.brand = brand;
}
Scanner in = new Scanner(System.in);
void call() {
System.out.println("enter the person name to be called");
String name;
name = in.nextLine();
System.out.println("calling " + name + " in " + brand);
}
void sendmsg() {
System.out.println("enter the message");
String msg;
msg = in.nextLine();
System.out.println("Message " + msg + " has been sent through" + brand);
}
void browse() {
System.out.println("enter the content to be browsed");
String browse;
browse = in.nextLine();
System.out.println(browse + "is being searched through " + brand);
}
void share() {
System.out.println("enter the content to be shared");
String share;
share = in.nextLine();
System.out.println(share + "is being shared through " + brand);
}
public static void main(String args[]) {
phone samsung = new phone(6.98, 13.6, 70000, "android", "Samsung");
phone iphone = new phone(12.3, 5.86, 100000, "ios", "Apple");
samsung.call();
iphone.call();
samsung.browse();
iphone.sendmsg();
}
}