Assignment1a - /*Hwa-Shy (Simon) Wu 454 5302 S Section 0 */...

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

View Full Document Right Arrow Icon
/*Hwa-Shy (Simon) Wu 454 5302 Section 0 */ S /*This program allows us to farmiliarize ourselved with Java language. It shows us the type of coding that Java does and doesn't understand. The variables assigned in the following program are all answers to questions 3, 4, and 5. Expressions that gave an incorrect answer (if it was to be handed in math class) were changed to the correct ones.*/ w // The "Assignment1" class. import apsc142.*; public class Assignment1 { public static void main (String[] args) { //question 3 / int answer3A, answer3B; double answer3C; answer3A= 5 + 10 % 3 + 2; //The original expression is legal in Java. //Answer is 14 (correct). Considering that desired % to mean modulus (the remainder). //Remember % takes precedence over +. answer3B= 5 + 10 %(3+2); //The original expression is legal in Java. //Answer is 5 (correct). Considering that desired % to mean modulus (the remainder). //Remember () takes precedence over everything.
Background image of page 1

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

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

This note was uploaded on 12/01/2010 for the course APPLIED SC 142 taught by Professor Professorstansimmons during the Winter '10 term at Queens University.

Page1 / 2

Assignment1a - /*Hwa-Shy (Simon) Wu 454 5302 S Section 0 */...

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