Activecode Exercises

Answer the following Activecode questions to assess what you have learned in this chapter.

Fix the code below so that it runs without errors. Hint: you might need to change the names of some variables.

Below is one way to fix the program. true and false are keywords, so they cannot be used as variable names.

Finish the code below so that it prints “I drive a 2014 Buick Regal”. Select the Pseudocode tab for hints for the construction of the code.

Finish the code below so that it prints “I drive a 2014 Buick Regal”. Use the lines to construct the pseudocode, then go back to complete the Activecode tab.

Fix the code below so that it prints “Cady scored 90% on the exam.”

Below is one way to fix the program. We want to use doubles so that our result isn’t rounded down to 0 through integer division.

Finish the code below so that it returns the correct volume of a sphere. Select the Pseudocode tab for hints for the construction of the code. Hint: think about what happens when you use integer division. The volume of a sphere is given by V = (4/3)(pi)(r^3).

Finish the code below so that it returns the correct volume of a sphere. Select the Parsonsprob tab for hints for the construction of the code. Hint: think about what happens when you use integer division. The volume of a sphere is given by V = (4/3)(pi)(r^3). Use the lines on to construct the pseudocode, then go back to complete the Activecode tab.

Fix the code below so that assigns a its correct value of 'a'. Hint: use character operations!

Below is one way to complete the program. There are many creative ways that you could use the order of operations to come up with a complex expression that will bring you to 'a', here is one way.

Write code that assigns “apples” to the variable oranges, and “oranges” to the variable apples, then swaps their values. Be sure to inclue any necessary headers. YOU MAY NOT HARDCODE YOUR SOLUTION. Select the Pseudocode tab for hints for the construction of the code.

Write code that assigns “apples” to the variable oranges, and “oranges” to the variable apples, then swaps their values. Be sure to inclue any necessary headers. Use the lines to construct the pseudocode, then go back to complete the Activecode tab.

Write code that prints “Eat”, “More”, and “Chicken” on 3 consecutive lines. Be sure to inclue any necessary headers.

Below is one way to implement the solution.

Write code that calculates how much you you will spend after tipping 20% on your $36.25 dinner. Save the result of this calculation in plusTip. Be sure to include any necessary headers. Select the Pseudocode tab for hints for the construction of the code.

Write code that calculates how much you you will spend after tipping 20% on your $36.25 dinner. Save the result of this calculation in plusTip. Use the lines to construct the pseudocode, then go back to complete the Activecode tab.

You have about three hours and fifteen minutes of homework to do today. Rather than starting it right away, you choose to procrastinate by calculating how many seconds you’ll be spending on your work. Convert the time to seconds and store the result in seconds. Be sure to inclue any necessary headers.

Below is one way to implement the solution.

Write code that calculates and prints the average of a and b if a = 3.14, and b = 1.59. You may only use one line of code. Be sure to inclue any necessary headers. Select the Pseudocode tab for hints for the construction of the code.

Write code that calculates and prints the average of a and b if a = 3.14, and b = 1.59. You may only use one line of code. Use the lines on the to construct the pseudocode, then go back to complete the Activecode tab.

You have attempted of activities on this page