exam1SOL - CIS 200 Exam 1 (50 points) Tuesday, February 9,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 200 Exam 1 (50 points) Tuesday, February 9, 2010 Name: ______________________________________ This test is closed-books and closed-notes. Please do your own work. 1. (6 pts) Write a complete Java program (everything that would go in the .java file) that prints the following information to the screen. Your information should be displayed exactly as it is below (except replace “Fred Jones” with your own name and “Olathe” with your home town). My name is Fred Jones. I am from Olathe.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. (12 pts) Write a code fragment with a loop that asks the user to enter 10 numbers, and that prints the smallest number that was entered. (For example, if the user entered 3, 2, 4, 6, 10, 3, 2, 4, 8, 12, then you would print that the smallest number was 2.) You will need to set up a Scanner to get the user input. Scanner s = new Scanner(System.in); int small = 0; for (int i = 0; i < 10; i++) { System.out.print(“Enter number: “); int num = Integer.parseInt(s.nextLine()); if (num < small || i == 0) { small = num; } } System.out.println(“Smallest: “ + small);
Background image of page 2
(10 pts) Suppose we have declared and initialized the following
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

exam1SOL - CIS 200 Exam 1 (50 points) Tuesday, February 9,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online