Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. //Created by: Lizette Gomez
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Project1_Lizette_Gomez_CSC
  6. {
  7. public static void main(String [] args)
  8. {
  9. //Declare final constants
  10. final double MULTIPLIER_RESOLUTION_1280x720 = 1;
  11. final double MULTIPLIER_RESOLUTION_1920x1080 = .75;
  12. final double MULTIPLIER_RESOLUTION_2560x1440 = .55;
  13. final double MULTIPLIER_RESOLUTION_3840x2160 = .35;
  14.  
  15. //Declare const Variables
  16. int resolutionChoice = 0;
  17. double multiplier = 0.0;
  18. double performanceScore = 0.0;
  19. double graphicsCardSpeed = 0.0;
  20. double processorSpeed = 0.0;
  21. double numberCores = 0.0;
  22. String resolution = "";
  23. String graphicsQuality = "";
  24. String title;
  25.  
  26. //scanner to take userinput
  27. Scanner keyboard = new Scanner(System.in);
  28.  
  29. //Ask the user for GPU, CPU and numberOfCores
  30. System.out.print("\n\nPlease enter the clock speed (in Megahertz) of your graphics card: ");
  31. graphicsCardSpeed = keyboard.nextDouble();
  32.  
  33. System.out.print("Please enter the clock speed (in Megahertz) of your processor: ");
  34. processorSpeed = keyboard.nextDouble();
  35.  
  36. System.out.print("Please enter the number of cores of your processor: ");
  37. numberCores = keyboard.nextDouble();
  38.  
  39. //Display the Resolution Menu
  40. System.out.println("What is the resolution of your monitor?");
  41. System.out.println("\t\t\t1. 1280 x 720");
  42. System.out.println("\t\t\t2. 1920 x 1080");
  43. System.out.println("\t\t\t3. 2560 x 1440");
  44. System.out.println("\t\t\t4. 3840 x 2160");
  45.  
  46.  
  47. //Ask option
  48. System.out.print("Please select from the options above: ");
  49. resolutionChoice = keyboard.nextInt();
  50.  
  51. //If-else Statement aka ==> logic for performanceScore
  52. if(resolutionChoice == 1)
  53. {
  54. performanceScore = ((5 * graphicsCardSpeed) + (numberCores * processorSpeed)) * MULTIPLIER_RESOLUTION_1280x720;
  55. resolution = "1280 x 720";
  56. }
  57. else if(resolutionChoice == 2)
  58. {
  59. performanceScore = ((5 * graphicsCardSpeed) + (numberCores * processorSpeed)) * MULTIPLIER_RESOLUTION_1920x1080;
  60. resolution = "1920 x 1080";
  61. }
  62. else if (resolutionChoice == 3)
  63. {
  64. performanceScore = ((5 * graphicsCardSpeed) + (numberCores * processorSpeed)) * MULTIPLIER_RESOLUTION_2560x1440;
  65. resolution = "2560 x 1440";
  66. }
  67. else if (resolutionChoice == 4)
  68. {
  69. performanceScore = ((5 * graphicsCardSpeed) + (numberCores * processorSpeed)) * MULTIPLIER_RESOLUTION_3840x2160;
  70. resolution = "3840 x 2160";
  71. }
  72.  
  73. //Another If-else Statement aka ==> logic for graphicsQuality
  74. if(performanceScore > 17000) //17001
  75. {
  76. graphicsQuality = "Ultra";
  77. }
  78. else if(performanceScore > 15000 && performanceScore <= 17000) //15001 17000
  79. {
  80. graphicsQuality = "High";
  81. }
  82. else if(performanceScore > 13000 && performanceScore <= 15000) //13001 15000
  83. {
  84. graphicsQuality = "Medium";
  85. }
  86. else if(performanceScore > 11000 && performanceScore <= 13000) //11001 13000 5
  87. {
  88. graphicsQuality = "Low";
  89. }
  90. else if(performanceScore <= 11000) //11000 242
  91. {
  92. graphicsQuality = "Unable to Play";
  93. }
  94.  
  95. title = "Computer Hardware Graphics Quality Recommendation Tool"; // STEP 8: String object to hold the title
  96. System.out.println("\n" + title + "\n");
  97.  
  98. //STEP 9: Display the output
  99. System.out.printf("GPU Clock Speed: %.0f MHz\n" , graphicsCardSpeed);
  100. System.out.printf("CPU Clock Speed: %.0f MHz\n" , processorSpeed);
  101. System.out.printf("Number of cores: %.0f\n" , numberCores);
  102. System.out.print("Monitor Resolution: " + resolution + "\n");
  103. System.out.printf("Performance Score: %,.3f\n", performanceScore);
  104. System.out.print("The Recommended Graphics Quality: " + graphicsQuality);
  105.  
  106. } //End of Main
  107. } //End of Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement