Skip to content

Commit 940c87b

Browse files
authored
Merge pull request #364 from habibasorour/issue_362_practice
Issue 362: added a practice question
2 parents 0eec4bf + 1389b47 commit 940c87b

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

source/ch2_firstjavaprogram.ptx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ Hello World!
366366
</program>
367367
</listing>
368368

369+
370+
371+
369372
</section>
370373

371374

@@ -476,6 +479,51 @@ Hello World!
476479
</choice>
477480
</choices>
478481
</exercise>
482+
483+
<exercise xml:id="java-name-color-parsons-exercise" label="java-name-color-parsons">
484+
<statement>
485+
<p>
486+
Construct a complete Java program that prints your name and your favorite color to the console.
487+
Drag the blocks into the correct order on the right.
488+
</p>
489+
</statement>
490+
<blocks>
491+
<block order="1">
492+
<choice correct="yes">
493+
<cline>public class NameColor {</cline>
494+
</choice>
495+
<choice correct="no">
496+
<cline>class NameColor {</cline>
497+
</choice>
498+
</block>
499+
500+
<block order="2">
501+
<choice correct="yes">
502+
<cline> public static void main(String[] args) {</cline>
503+
</choice>
504+
<choice correct="no">
505+
<cline> public static main(String[] args) {</cline>
506+
</choice>
507+
</block>
508+
509+
<block order="3">
510+
<choice correct="yes">
511+
<cline> System.out.println("Name: Alex");</cline>
512+
<cline> System.out.println("Favorite Color: Blue");</cline>
513+
</choice>
514+
<choice correct="no">
515+
<cline> system.out.println(Name: Alex);</cline>
516+
<cline> System.out.println("Favorite Color: Blue")</cline>
517+
</choice>
518+
</block>
519+
520+
<block order="4">
521+
<cline> }</cline>
522+
<cline>}</cline>
523+
</block>
524+
</blocks>
525+
</exercise>
526+
479527
</reading-questions>
480528
</section>
481529
</chapter>

0 commit comments

Comments
 (0)