-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu.java
More file actions
47 lines (46 loc) · 1.01 KB
/
cpu.java
File metadata and controls
47 lines (46 loc) · 1.01 KB
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
import java.util.*;
class cpu
{
float price;
cpu(Scanner sc)
{
System.out.println("Enter the cpu price:");
price=sc.nextFloat();
}
class processor
{
int cores;
String manufacturer;
processor(Scanner sc)
{
System.out.println("Enter no of Cores");
cores=sc.nextInt();
sc.nextLine();
System.out.println("Enter the Manufacturer");
manufacturer=sc.nextLine();
}
}
static class ram
{
int memory;
String manufacturer;
ram(Scanner sc)
{
System.out.println("Enter the memory");
memory=sc.nextInt();
sc.nextLine();
System.out.println("Enter the manufacturer");
manufacturer=sc.nextLine();
}
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
cpu cpu=new cpu(sc);
cpu.processor p=cpu.new processor(sc);
cpu.ram r=new cpu.ram(sc);
System.out.println("the price is"+cpu.price);
System.out.println("The no of Cores is:"+" "+p.cores+" "+"and the Manufacturer is:"+" "+p.manufacturer);
System.out.println("Memory is:"+" "+r.memory+"gb ram Manufacturer"+" "+r.manufacturer);
}
}