Coding Practice¶
Write the function printCakeInfo
, which prints the cake’s information in the format
“This is a color
, diameter
inch diameter cake with/without icing.” If name
does not
have the value “n/a”, printCakeInfo
prints out “Happy birthday name
! Your cake is color
,
has a diameter
inch diameter, and comes with/without icing.” Select the Parsonsprob tab for hints
for the construction of the code.
Write the function printCakeInfo
, which prints the cake’s information in the format
“This is a color
, diameter
inch diameter cake with/without icing.” If name
does not
have the value “n/a”, printCakeInfo
prints out “Happy birthday name
! Your cake is color
,
has a diameter
inch diameter, and comes with/without icing.” Use the lines to construct the code,
then go back to complete the Activecode tab.
Write the function changeCakeDiameter
, which takes a Cake
and a double
as a parameter.
changeCakeDiameter
then multiplies the original diameter by the double and modifies the cake
to have this new diameter. Select the Parsonsprob tab for hints for the construction of the code.
Write the function changeCakeDiameter
, which takes a Cake
and a double
as a parameter.
changeCakeDiameter
then multiplies the original diameter by the double and modifies the cake
to have this new diameter. Use the lines to construct the code, then go back to complete the Activecode tab.
Write the struct Shirt
, which has the instance variables color and size.
Select the Parsonsprob tab for hints for the construction of the code.
Write the struct Shirt
, which has the instance variables color and size.
Use the lines to construct the code, then go back to complete the Activecode tab.
Write the struct Outfit
, which is a nested structure that has a Shirt
, Pants
, and has_hat.
Select the Parsonsprob tab for hints for the construction of the code.
Write the struct Outfit
, which is a nested structure that has a Shirt
, Pants
, and has_hat.
Use the lines to construct the code, then go back to complete the Activecode tab.
Write the changeShirts
and changePants
functions, which both take an Outfit
as a parameter. changeShirts
also
takes a Shirt
as a parameter and changePants
also takes a Pants
as a parameter. Each function modifies the Outfit
and changes the shirt or pants to the new input. Select the Parsonsprob tab for hints for the construction of the code.
Write the changeShirts
and changePants
functions, which both take an Outfit
as a parameter. changeShirts
also
takes a Shirt
as a parameter and changePants
also takes a Pants
as a parameter. Each function modifies the Outfit
and changes the shirt or pants to the new input. Use the lines to construct the code, then go back to complete the Activecode tab.