Write a code fragment that reads 10 integer values from the user and prints the highest value entered.

What will be an ideal response?

```
Scanner scan = new Scanner(System.in);
int max, number;
System.out.print("Enter an integer: ");
max = scan.nextInt();
for (int count = 2; count <= 10; count++)
{
System.out.print("Enter another integer: ");
number = scan.nextInt();
if (number > max)
max = number;
}
System.out.println("The highest value is :" + max);

```

Computer Science & Information Technology

You might also like to view...

Critical Thinking QuestionsCase 2-1You are planning a new presentation on marketing that you will deliver to your Intro to Business class. PowerPoint displays many themes that are varied and appealing and give you an excellent start at designing a presentation. However, you have a specific topic and design concept and could use some assistance in starting to develop the presentation. You ____. a. create your own templatec. use WordArtb. give careful thought to slide textd. can search for one of Microsoft's ready-made presentations or browse one of the predefined categories

What will be an ideal response?

Computer Science & Information Technology

Your program should use a switch structure to help determine the retail price for each product. Your program should calculate and ouput HTML that displays the total retail value of all products sold last week. Use a prompt dialog to obtain the product num- ber from the user. Use a sentinel-controlled loop to determine when the program should stop looping and display the final results.

A mail order house sells five different products whose retail prices are: product 1— $2.98, product 2—$4.50, product 3— $9.98, product 4—$4.49, and product 5—$6.87. Write a script that reads a series of pairs of numbers as follows: a) Product number b) Quantity sold for one day

Computer Science & Information Technology