1 / 19

Review Programming Style

Review Programming Style. Joe McCarthy. File Names. Assign1.java assign1.java Assignment1.java. Scanner type = new Scanner (System.in); … newline(); repeat(); newline(); end();. Method & variable names. Scanner type = new Scanner (System.in); … newline();

colton
Download Presentation

Review Programming Style

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ReviewProgramming Style Joe McCarthy CSS 161: Fundamentals of Computing

  2. File Names • Assign1.java • assign1.java • Assignment1.java CSS 161: Fundamentals of Computing

  3. Scanner type = new Scanner (System.in); • … • newline(); • repeat(); • newline(); • end(); CSS 161: Fundamentals of Computing

  4. Method & variable names • Scanner type = new Scanner (System.in); • … • newline(); • repeat(); • newline(); • end(); CSS 161: Fundamentals of Computing

  5. Ithink(); • System.out.println(); • Ifeel(); • System.out.println(); CSS 161: Fundamentals of Computing

  6. CamelCase • iThink(); • System.out.println(); • iFeel(); • System.out.println(); CSS 161: Fundamentals of Computing

  7. public class Assignment1a { public static void main (String[] args) { System.out.println("\nI'll tell you something"); … public static void hide () { System.out.println("I can't hide"); } public static void pleaseSay () { System.out.print("please say to me\nyou'll let me"); } CSS 161: Fundamentals of Computing

  8. Indentation & Spacing public class Assignment1a { public static void main (String[] args) { System.out.println("\nI'll tell you something"); … public static void hide () { System.out.println("I can't hide"); } public static void pleaseSay () { System.out.print("please say to me\nyou'll let me"); } CSS 161: Fundamentals of Computing

  9. public class Assign1{ public static void main (String[] args) { vsOne(); System.out.println(); vsTwo(); vsRep(); vsRep2(); vsRep(); vsRep2(); } public static void holdHand() { System.out.println("I want to hold your hand"); } CSS 161: Fundamentals of Computing

  10. Indentation & Spacing public class Assign1 { public static void main (String[] args) { vsOne(); System.out.println(); vsTwo(); vsRep(); vsRep2(); vsRep(); vsRep2(); } public static void holdHand() { System.out.println("I want to hold your hand"); } CSS 161: Fundamentals of Computing

  11. public static void main (String[] args) { first(); hold(); space(); say(); space(); chorus(); space(); second(); hold(); space(); chorus(); space(); second(); hold(); } CSS 161: Fundamentals of Computing

  12. Spacing public static void main (String[] args) { first(); hold(); space(); say(); space(); chorus(); space(); second(); hold(); space(); chorus(); space(); second(); hold(); } CSS 161: Fundamentals of Computing

  13. public class Assign1 { public static void main (String[] args) { // display first verse System.out.print("I'll tell you something"); System.out.println(); CSS 161: Fundamentals of Computing

  14. Indentation & Spacing public class Assign1 { public static void main (String[] args) { // display first verse System.out.print("I'll tell you something"); System.out.println(); CSS 161: Fundamentals of Computing

  15. public class Assign1{ public static void main (String[]args){ // display first verse System.out.println("I'll tell you something"); CSS 161: Fundamentals of Computing

  16. Indentation & Spacing public class Assign1{ public static void main (String[]args){ // display first verse System.out.println("I'll tell you something"); CSS 161: Fundamentals of Computing

  17. System.out.println(); System.out.println("Oh please say to me \nyou'll let me be your man \nand please say to me \nyou'll let me hold your hand \nNow, let me hold your hand \nI want to hold your hand"); System.out.println(); CSS 161: Fundamentals of Computing

  18. Run-on statements System.out.println(); System.out.println( "Oh please say to me \n" + "you'll let me be your man \n" + "and please say to me \n" + "you'll let me hold your hand \n" + "Now, let me hold your hand \n" + "I want to hold your hand" ); System.out.println(); CSS 161: Fundamentals of Computing

  19. System.out.println(); System.out.println( "Oh please say to me\n" + "you'll let me be your man\n" + "and please say to me\n" + "you'll let me hold your hand\n" + "Now, let me hold your hand\n" + "I want to hold your hand\n" ); CSS 161: Fundamentals of Computing

More Related