Warning This class is being recorded.
Another TPS activity.
mainin multiple classes. Usually the Java environment is smart enough to know which one you want.
newwhenever you call a constructor.
You can ask questions about anything related to the class! Self gov says that you should ask those questions.
How do I have classes reference each other?
If they are in the same package and have the appropriate protection, using the basic class name.
If they are in different packages, you must either use the full specification (e.g.,
java.math.BigInteger) or use an
How can we check if an arbitrary value is of a certain type?
For primitive types (e.g.,
double), we generally trust the Java type system.
For objects, you can write
(var instanceof Class). Also
(var instanceof Interface).
If we want to determine whether, say,
chis a lowercase letter, we probably have a helpful procedure in the
As C programmers, we might also write
((ch >= 'a') && (ch <= 'z'))
What will LAs look like for this class?
Option one: I may ask you to do something related to the topic of the day that draws upon knowledge you should already have for a learning outcome. For example, when we study queues, I might ask “Under the PUM approach, what methods would you specify for a queue? Write them down on a piece of paper.” (Note that I do this already; we’ll just have you showing off your knowledge on paper.)
Option two: I may ask you to fill out a form indicating where you had demonstrated mastery of something. For example, if “Parsing strings” were a learning outcome, you could write “I demonstrated my knowledge of parsing strings on Mini-Project 2. Here’s the relevant code.”
How should I implement the registers? It strikes me that an array is a good idea?
I would use
BigFraction registers, with the 26 registers corresponding to the 26 lowercase letters.
We already know how to convert a lowercase letter to a number between 0 and 25 because we did so on MP1.
Given a lowercase letter, the value stored in the register is
You can store in it with
registers[convert(ch)] = someBigFraction;
What do I store when I encounter
The value of the last expression calculated.
How do I keep track of that?
I’d suggest a field in your
QuickCalculator have to store in registers?
What does the QuickCalulator have to print out?
Something reasonable. (Incomplete specs mean freedom.)
Option 1: Each expression followed by its value.
Option 2: Value of each expression.
Option 3: Value of the last expression.
Will the post-assessment still be due tonight?
No. I’m moving it.
Is it due on Thursday?
Yes, unless VSCode/MathLAN crash again.
Please don’t try to make them crash.