-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion56_LaptopConfigurator.java
More file actions
80 lines (60 loc) · 2.51 KB
/
Question56_LaptopConfigurator.java
File metadata and controls
80 lines (60 loc) · 2.51 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package week6_String;
import java.util.Scanner;
public class Question56_LaptopConfigurator {
public static void main(String[] args) {
// olcay // Jul 6, 2020
/*First ask user for a screen size. If screen size is equals to 13.3, add $200 to the laptop price.
* If screen size is equals to 15.0 - add $300 to the laptop price. If screen size is equals to
* 17.3 - add $400 to the laptop price.Then ask user for CPU type. If CPU type equals to i3, add
* $150 to the laptop price. If CPU type equals to i5, add $250 to the laptop price. If CPU type
* equals to i7, add $350 to the laptop price. Then ask user for RAM size. Add $50 for every 4GB
* of ram to the laptop price. Then, ask user for storage type. There are 2 options: SSD and HDD.
* If it's HDD - add $50 to the laptop price for every 500gb. If it's SSD - add $100 to the laptop
* price for every 500GB. Then ask user for for screen resolution. There are 2 options: FULLHD and 4K.
* Add $100 if it's FULLHD screen and $200 if it's 4K screen.
*/
double price = 0;
String storageType, screenType, cpu;
int ram = 0;
int memorySize=0;
Scanner scan = new Scanner(System.in);
System.out.print("Select screen size(13.3,15.0 or 17.3): ");
screenType = scan.nextLine();
if(screenType.equals("13.3")){
price+=200;
}else if(screenType.equals("15.0")){
price+=300;
}else if(screenType.equals("17.3")) {
price+=400;
}
System.out.print("Select CPU type(i3, i5 or i7): ");
cpu=scan.nextLine();
if(cpu.equals("i3")) {
price+=150;
}else if(cpu.equals("i5")) {
price+=250;
}else if(cpu.equals("i7")) {
price+=350;
}
System.out.print("Select RAM size: ");
ram=scan.nextInt();
price=price+(ram/4*50);
System.out.print("Select storage type(SSD or HDD): ");
storageType=scan.next();
System.out.print("Enter memory size(500, 1000, ...) ");
memorySize=scan.nextInt();
if(storageType.equals("HDD")) {
price=price+(memorySize/500*50);
}else if(storageType.equals("SSD")) {
price=price+(memorySize/500*100);
}
System.out.print("Enter screen resolution: ");
screenType=scan.next();
if(screenType.equals("FULLHD")) {
price+=100;
}else if(screenType.equals("4K")) {
price+=200;
}
System.out.println("Laptop price is: " + price);
}
}