cid 2 worksheet

2
Creator ID: 53052674 Answerer ID:___________ _ Lesson 8 Topics:, if-ese state!ents "# $ri te t%e c o&e to si!'at e a coin ( ip# )rint t%e re s't of t%e (ip * ie# If t%e res't is %ea&s print %ea&s+# i!port aa#'ti#.an&o!/ p'ic cass Coin1ip p'ic static oi& !ain*trin ars+ .an&o! (ip new .an&o!*+/ int coin (ip#netInt*2+9" / if*coin-"*";"000000000++ <ste!#o't#printn*=>ea&s?+/ @ ese <ste!#o't#prinn*=Tais?+/ @ @ @ 2# $rite t%e co&e to &eter!ine w%et%er or not t%e 'ser passe& t%eir cass# aBe s're to pro!pt t%e! for t%eir ra&e# Ass'!e t%at a passin ra&e is a C- *70+# i!port aa#'ti#canner/ p'ic cass )assinra& e p'ic static oi& !ain*trin ars+ canner in new canner*<ste!#in+/ <ste!#o't#print*=Enter <o'r ra&e: =/ Do'e ra&e in#netDo'e*+/ if *ra&eF70+ <ste!#o't#printn*=)ass?+/ @ ese <ste!#o't#printn*=Go pass?+/ @ @ @

Upload: chris-lin

Post on 07-Jan-2016

212 views

Category:

Documents


0 download

DESCRIPTION

AP computer science worksheet

TRANSCRIPT

Page 1: CID 2 worksheet

7/17/2019 CID 2 worksheet

http://slidepdf.com/reader/full/cid-2-worksheet 1/1

Creator ID: 53052674 Answerer ID:____________ 

Lesson 8 Topics:, if-ese state!ents

"# $rite t%e co&e to si!'ate a coin (ip# )rint t%e res't of t%e (ip *ie# If

t%e res't is %ea&s print %ea&s+#

i!port aa#'ti#.an&o!/p'ic cass Coin1ip

p'ic static oi& !ain*trin ars+.an&o! (ip new .an&o!*+/int coin (ip#netInt*2+9"/if*coin-"*";"000000000++

<ste!#o't#printn*=>ea&s?+/@ ese

<ste!#o't#prinn*=Tais?+/@

@

@

2# $rite t%e co&e to &eter!ine w%et%er or not t%e 'ser passe& t%eir cass#

aBe s're to pro!pt t%e! for t%eir ra&e# Ass'!e t%at a passin

ra&e is a C- *70+#

i!port aa#'ti#canner/p'ic cass )assinra&e

p'ic static oi& !ain*trin ars+canner in new canner*<ste!#in+/<ste!#o't#print*=Enter <o'r ra&e: =/Do'e ra&e in#netDo'e*+/

if *ra&eF70+<ste!#o't#printn*=)ass?+/

@ ese<ste!#o't#printn*=Go pass?+/

@@

@