- Get familiar with boolean expressions
- Get familiar using if-then-else statements
- Get familiar using switch statements
The types of programs you currently have the ability to create must strictly adhere to just one possible path of execution. This means that your programs can really do only one type of action or calculation, such as generating a username or displaying the area of a triangle. Selection, using if-then-else and/or switch statements, opens up a new world of possibilities by allowing a computer to evaluate one or more conditions, then act on them.
For instance, instead of making separate programs to let a user calculate the area of circles, triangles, and squares, you can now build all of that functionality into one program, and present the user with a menu to choose from. You will experiment with the use of selection to determine menu choices below.
For this homework, your task is to create a program that prompts a user for their choice of processor, memory, storage, graphics, and mouse or trackpad. The program should then display the total price of the desktop computer with the desired specifications. Since we are dealing with money, please display the total price with two decimal places.
Note that the starting price of the desktop to be customized is 4999.0. The pricing is based off of the machine here. Please use the example output below to see how your program should look. The output you get on your screen should match that in the picture — please be careful with typos. Below is the cost to be added for each component.
|8-core Intel Xeon W||0.0|
|10-core Intel Xeon W||800.0|
|14-core Intel Xeon W||1600.0|
|18-core Intel Xeon W||2400.0|
|32GB DDR4 RAM||0.0|
|64GB DDR4 RAM||800.0|
|128GB DDR4 RAM||2400.0|
|Radeon Pro Vega 56||0.0|
|Radeon Pro Vega 64||600.0|
Mouse or Trackpad
You are required to create one class, ComputerCustomizer, that follows the specifications outlined above. It is to be held in a file called ComputerCustomizer.java. For this homework, you can assume that the user will only enter a valid menu choice.