UWB CSS 161 Fundamentals of Computing

UWB CSS 161 Fundamentals of Computing

Programming Style Joe McCarthy CSS 161: Fundamentals of Computing 1 Some interesting jobs Fixing Camaros Teaching tennis Babysitting T-shirt vendor Seattle Air Route Traffic Control Center USN Battle Force Tactical Trainer

mental health therapist / chemical dependency counselor Mount Rainier volunteer coordinator Robot [controller] designer Sears customer service Waiter Social media analyst USN [air base] Bartender Construction worker Daycare worker Golf instructor

Tester Auction hall usher Game tester Hotel night auditor Volunteer translator Bank teller Kenmore Air crew member CPA assistant Youth football camp volunteer Dick's Drive-In crew member Goodwill donation acceptor High school student store manager Math/Eng/Sci chaperone & tutor CSS 161: Fundamentals of Computing 2 Assignment1 directory adam512 aleksb alia5 amosao bakerac bav007 bdonaghy bensaul chris87 cwgunn

cwj5 davidm92 dyndad fengyue8 griffi hmalik hurdj3 jasonden johnyoon kevinz2 kiunab kkhunt7 kvn101 lchea122 leechr93 mdlu00 nickabel CSS 161: Fundamentals of Computing peters85 pkhaouly shastan talbrech thienq uwerict6 yeminz 3

How I tested Assignment 1 for dir in Assignment1/* do echo echo $dir cd $dir javac Calculator.java rm -f Calculator.output echo 7 2 | java Calculator >> Calculator.output echo 2 7 | java Calculator >> Calculator.output echo 100 200 | java Calculator >> Calculator.output echo -10 -20 | java Calculator >> Calculator.output echo diff diff -q ../../Calculator.output Calculator.output echo diff -qB diff -qB ../../Calculator.output Calculator.output echo diff -qb diff -qb ../../Calculator.output Calculator.output echo diff -qw diff -qw ../../Calculator.output Calculator.output cd ../.. done CSS 161: Fundamentals of Computing 4 Next Lab How to connect to uw1-320-lab.uwb.edu Optional, if you want to test / verify your program

in same environment that I will be using Plus a lab assignment CSS 161: Fundamentals of Computing 5 Perfect Match diff diff -qB diff -qb diff -qw CSS 161: Fundamentals of Computing 6 Extra blank line[s] / space[s]: OK diff Files ../../Calculator.output and Calculator.output differ diff -qB diff -qb Files ../../Calculator.output and Calculator.output differ diff -qw Files ../../Calculator.output and Calculator.output differ diff Files ../../Calculator.output and Calculator.output differ

diff -qB Files ../../Calculator.output and Calculator.output differ diff -qb diff -qw CSS 161: Fundamentals of Computing 7 More significant differences diff Files ../../Calculator.output diff -qB Files ../../Calculator.output diff -qb Files ../../Calculator.output diff -qw Files ../../Calculator.output and Calculator.output differ and Calculator.output differ and Calculator.output differ and Calculator.output differ Now I have to examine your output carefully and possibly re-run your program to determine the degree of correctness which will certainly be less than 100% CSS 161: Fundamentals of Computing

8 /** * This program will perform calculations on two integers. Brief description to programmers * Your name * @author Joe McCarthy * @version 16 January 2013 Due date Blank lines to separate */ import statement block import java.util.Scanner; class declaration method definitions public class Calculator { Brief description to users public static void main(String[] args) { System.out.println("This program will perform calculations on two integers."); System.out.println(); System.out.println("Enter two integers, separated by a space:"); Scanner keyboard = new Scanner(System.in); int number1 = keyboard.nextInt(); int number2 = keyboard.nextInt(); Indentation

int int int int int sum = number1 + number2; difference = number1 - number2; product = number1 * number2; quotient = number1 / number2; remainder = number1 % number2; System.out.println(); System.out.printf("%d System.out.printf("%d System.out.printf("%d System.out.printf("%d System.out.printf("%d + %d = %d\n", number1, number2, sum); - %d = %d\n", number1, number2, difference); * %d = %d\n", number1, number2, product); / %d = %d\n", number1, number2, quotient); %% %d = %d\n", number1, number2, remainder); } } Blank lines to separate

major code sections (input, calculations, output) Blank spaces before braces before & after operators CSS 161: Fundamentals of Computing No extraneous blank lines at end (before closing brace) 9 Other issues calculator.java vs. Calculator.java System.out.println() vs. System.out.println() System.out.println() vs. System.out.printf() %% to print % in output Did anyone try 0 and 0 as input? Note: I do not check Catalyst Dropbox for comments If you have a question, post on Discussion Board (or email me if question would reveal too much) CSS 161: Fundamentals of Computing 10

Recently Viewed Presentations

  • The End of Farm Labor Abundance - California

    The End of Farm Labor Abundance - California

    US workers stopped doing hired farm work in the 1900s. A few US kids dream of being farmers, but not . hired farmworkers. Immigration solved our farm labor problem. Mexico was at an earlier stage of the farm labor transition....
  • Sustainable Communities Workshop Eight Principles Relating to Ecological

    Sustainable Communities Workshop Eight Principles Relating to Ecological

    The principle "tool" nature uses to create and maintain communities is symbiosis. The most important components are: a. Competition, both intra- and inter-specific. ... diversity and redundancy. Anything damaging this diversity and redundancy probably reduces sustainability.
  • Static Longitudinal Stability

    Static Longitudinal Stability

    One-Pilot Rest Area. Two-3 Passenger Sofa Seats. Two-Reclining Crew Seats. Two-Shared Tables. Maximum Passengers: 16. Volume / Passenger max cap.: 150 (ft3) Cabin Layout and Dimensions. Lifting Canard. Pros Cons. Designed to provide more lift at high speeds.
  • AHS Tricolor Winners Through the Years Compiled and ...

    AHS Tricolor Winners Through the Years Compiled and ...

    TOUCHED BY MIDAS. 24. Daylily Tango by Nell Shimek, 1997, Brazosport club show, theme: Born to Boogie with Daylilies. 25. 'Vegas Lights" is the title. ... Chattahoochee Valley Daylily Soc., Columbus, GA. Mrs. Clark Duncan, 1992. 44. A creative design...
  • Eschatology, a Broad Perspective From Genesis to Revelation

    Eschatology, a Broad Perspective From Genesis to Revelation

    Smyrna. Prosperous sheltered port city on Aegean sea in modern-day Izir, Turkey. Well educated population of 150,000-200,000 during biblical times (Greeks, Romans, Jews, and Christians)
  • Word Study #4 -therm-

    Word Study #4 -therm-

    substance or significanceprefix: in- =insuffix: -ance=action or process Word Study #2 -port- / - portat - ( portare ) means to carry; entrance (Latin origins) import (verb) = to carry or bring into another place or countryprefix = in- =...
  • Figure S6 Total miRNAs Upregulated miRNAs Downregulated miRNAs

    Figure S6 Total miRNAs Upregulated miRNAs Downregulated miRNAs

    Zhou, L., Qi, X., Potashkin, J.A., Abdul-Karim, F.W. and Gorodeski, G.I. (2008) MicroRNAs miR-186 and miR-150 down-regulate expression of the pro-apoptotic purinergic P2X7 receptor by activation of instability sites at the 3'-untranslated region of the gene that decrease steady-state levels...
  • Town of Chapel Hill Come Learn With Us

    Town of Chapel Hill Come Learn With Us

    Remaining Gap: $567,500 . Anticipated LIHTC amount: $648,480 - $14,740 per affordable unit. $567,500 of NHTF could be structured as low-rate, subordinate debt - which would allow this property to be developed in a financial feasible manner. 15