Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: in java Review the sample program before starting this project. put the sample program at the end Playing a video game on

Instructions: "in java "

Review the sample program before starting this project. put the sample program at the end

Playing a video game on a computer can give different experiences based on the performance capabilities of the computers hardware (typically processor and graphics card among other things).

Playing a video game on a computer can give different experiences based on the performance capabilities of the computers hardware (typically processor and graphics card among other things).

developers of a new game will typically have recommended specifications for the computer hardware that is required to run their games on a variety of graphics settings (the faster the hardware, the higher the graphics quality).

You are being tasked to create a program that will tell a gamer what graphics quality they will be able to run a newly developed video game on, based on the specifications of their computers hardware.

Note: When declaring variables, initialize all variables to avoid the following error message: variable might not have been initialized.

Step 1:

Ask the user to enter the clock speed (in Megahertz) of their graphics card (GPU). This is an indicator of how fast their graphics card is.

Step 2:

Ask the user to enter the clock speed (in Megahertz) of their processor (CPU). This is an indicator of how fast their processor is.

Step 3:

Ask the user to enter the number of cores that their processor (CPU) has. The more cores a processor has, the more work it can do.

Step 4:

Display a menu and ask the user to select the resolution of their monitor.

The menu should contain the following options:

1. 1280 x 720

2. 1920 x 1080

3. 2560 x 1440

4. 3840 x 2160

Note: Resolution consists of two numbers separated by an x. The first number is the number of pixels in the width of the screen. The second number is the number of pixels in the height of the screen. We are not asking you to perform multiplication on this step!

Step 5:

Assign a multiplier value (that will be used in a calculation in a later step) based on the monitor resolution by using the following table:

Resolution Multiplier
1280 x 720 1
1920 x 1080 .75
2560 x 1440 .55
3840 x 2160 .35

Step 6:

Calculate a performance score by using the following formula:

Performance Score = ((5 * GPU Clock Speed) + (Number of Cores * CPU Clock Speed)) * Multiplier

Example: A GPU with a clock speed of 1200MHz, a 4-core CPU with a clock speed of 4200 MHz, and a 1280 x 720 resolution monitor would have a Performance Score calculation of:

Performance Score = ((5 * 1200) + (4 * 4200)) * 1 = 22800

Step 7:

Determine the recommended graphics quality that the hardware can support by using the information in the table below.

Performance Score Recommended Graphics
Over 17,000 Ultra
Over 15,000 but not more than 17,000 High
Over 13,000 but not more than 15,000 Medium
Over 11,000 but not more than 13,000 Low
11,000 or less Unable to Play

Step 8:

Create a String object in memory to hold the text Computer Hardware Graphics Quality Recommendation Tool. Display that text at the top of the output (See sample Input and Output below).

Step 9:

Display the following output (See sample Input and Output below):

The GPU clock speed

The CPU clock speed

The number of cores

The Monitor Resolution

The Performance Score (formatted with a comma and to three decimal places)

The Recommended Graphics Quality

The code you submit should be thoroughly documented with comments where appropriate.

Sample Input and Output (user input is in bold)

Please enter the clock speed (in Megahertz) of your graphics card: 1000

Please enter the clock speed (in Megahertz) of your processor: 3000

Please enter the number of cores of your processor: 2

What is the resolution of your monitor?

1. 1280 x 720

2. 1920 x 1080

3. 2560 x 1440

4. 3840 x 2160

Please select from the options above: 1

Computer Hardware Graphics Quality Recommendation Tool

GPU Clock Speed: 1000 MHz

CPU Clock Speed: 3000 MHz

Number of cores: 2

Monitor Resolution: 1280 x 720

Performance Score: 11,000.000

Recommended Graphics Quality: Unable to Play

sample program......................sample program.....................sample program.................

/* This program demonstrates how to properly display a menu and prompt the user for their input. In this example, the menu gives options for a health club membership and asks the user to make a selection. The program then asks for the number of months that the membership will last. Finally, it calculates the cost of the membership based on the type of membership and the number of months the membership will last. */ import java.util.Scanner;//needed in order to be able to use the Scanner class to get the user's input public class MenuExample { public static void main(String[] args) { int choice = 0;//to hold the menu choice int numMonths = 0;//to hold the number of months for the membership double totalCost = 0.0;//to hold the total cost of the membership double costPerMonth = 0.0;//to hold the total cost of the membership - initialized to 0.0 to avoid compiler message later on //constants to hold the cost of the membership types final double ADULT_COST = 40.0; final double CHILD_COST = 20.0; final double SENIOR_COST = 30.0; //constants to represent the menu options final int ADULT_CHOICE = 1; final int CHILD_CHOICE = 2; final int SENIOR_CHOICE = 3; Scanner keyboard = new Scanner(System.in);//create a Scanner object to get the user's input //Display the Menu System.out.println("Health Club Membership Menu"); System.out.println("1. Standard Adult Membership - $40 per month"); System.out.println("2. Child Membership - $20 per month"); System.out.println("3. Senior Citizen Membership - $30 per month"); System.out.print(" Enter your choice: ");//Ask the user to make a selection from the menu choice = keyboard.nextInt();//read in the user's input for the menu selection System.out.print("How many months will the membership last? ");//ask the user for the number of months that the membership will last numMonths = keyboard.nextInt();//read in the user's input for the number of months //Use if/else if statement to appropriately handle the user's selection //assign the correct value to our costPerMonth variable based on the user's selection if(choice == ADULT_CHOICE) { costPerMonth = ADULT_COST; } else if(choice == CHILD_CHOICE) { costPerMonth = CHILD_COST; } else if(choice == SENIOR_CHOICE) { costPerMonth = SENIOR_COST; } /* //Since there is only a single statement that we want to conditionally execute in the body of each if-statement, //we can optionally omit the curly braces to make the code shorter as shown below. // //Be aware that this only works when you want to conditionally execute a SINGLE statement. //If you have multiple statements that you want to execute, you MUST include them in curly braces // //To test this, you can comment out the if-else-if statements above and use the code below instead: if(choice == ADULT_CHOICE) costPerMonth= ADULT_COST; else if(choice == CHILD_CHOICE) costPerMonth = CHILD_COST; else costPerMonth = SENIOR_COST; */ totalCost = costPerMonth * numMonths; //calculate the total cost using the correct cost per month assigned above System.out.printf("The cost of the membership is $%.2f",totalCost);//display the total cost of the membership, formatting the output to two decimal places }//end main }//end class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Give details of the use of ICT in workforce planning

Answered: 1 week ago

Question

Explain the various meanings of and approaches to flexible working

Answered: 1 week ago