HW2 - Scanner scan = new Scanner(System.in...

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

View Full Document Right Arrow Icon
Katherine Kahla CompSci 125 – 001 HW2 2.10. Given the following declarations, what result is stored in each f the listed assignment statements? a. 5 b. 5.0 c. 3 k. 3 l. 3.0 m. 0.0 q. 0 2.11. For each of the following expressions, indicate the order in which the operators will be evaluated by writing a number beneath each operator. d. a + b / c * d 3 1 2 e. a / b * c * d 1 2 3 f. a % b / c * d 1 2 3 g. a % b % c % d 1 2 3 k. a % (b % c) * d – e 2 1 3 4 2.17. Assuming you have a Graphics object called page, write a statement that will draw a circle centered on point (50,50) with a radius of 20 pixels. page.drawOval(30, 30, 40, 40); PP 2.7. import java.util.Scanner; public class Converter { public static void main(String[] args) { int seconds, minutes, hours, remainder, seconds_old;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Scanner scan = new Scanner (System.in); System.out.print( "How many seconds do you wish to convert?: " ); seconds = scan.nextInt(); seconds_old = seconds; hours = seconds / 3600; remainder = seconds % 3600; minutes = remainder / 60; seconds = remainder % 60; System.out.println(seconds_old + " seconds would be: " + hours + " hours, " + minutes + " minutes, and " + seconds + " seconds" ); } } PP 2.19 import java.awt.*; import javax.swing.JApplet; public class HW2 extends JApplet { public void paint(Graphics page) { Font font = new Font( "Serif" , Font. BOLD , 36); page.setFont(font); page.drawString( "Katy Kahla" , 5, 30); page.setColor(Color. pink ); page.drawString( "Katy Kahla" , 7, 32); } }...
View Full Document

This note was uploaded on 03/22/2012 for the course COMPSCI 125 taught by Professor Cole during the Spring '12 term at Boise State.

Page1 / 2

HW2 - Scanner scan = new Scanner(System.in...

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

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