Common Computer Science References
At the end of this lesson, you will be able to:
create an application that uses complex math and "large" variable types
prevent invalid input from the user
the importance of a good design BEFORE you start coding!
the importance of checking the input
try ... catch statements
or more likely, a bunch of if statements!
review how bun-promptx works:
it returns a dictionary
after getting the item out, it is actually of type (string | null)!
read "Structured Problem Solving", Chapter 2, Computer Based Problem Solving
read up to and including "Sequence"
read the following problem:
Albert Einstein's famous equation E = mc² gives the amount of energy (in Joules) released when an object of a certain mass (in kg) is converted to energy. If the speed of light (c) is 2.998x10⁸ m/s write a program that will allow the user to enter the mass of an object and then sees how much energy could be released from that object.
use a try ... catch (or if statement) to ensure the user is entering in a number and not text or nothing!
this might be useful:
read "Try ... Catch"
do the above in a second language