CS 21a Section B/E
Lab 2b
- Start with your Lab 2 (Egg Trader) submission.
- Arrange it so that the buyOneDozen() method
does not proceed with the purchase when the egg trader
does not have enough cash.
(Print the message: "Not enough cash").
- Arrange it so that the sellEggs() method
does not proceed with the sale when the egg trader
does not have enough eggs.
(Print the message: "Not enough eggs").
- Add a constructor to the EggTrader class
that allows you to specify the initial cash on hand.
(e.g., EggTrader e = new EggTrader();
starts the egg trader with 500 pesos,
EggTrader e = new EggTrader( 125.00 );
starts the egg trader with 125 pesos)
- Create a new tester program
(Call it Lab2bTester) with the code
provided by your instructor.
- (Optional)
Revise the tester so that it
asks the user for input values instead
(starting cash, price per dozen, number of eggs to sell,
and price per egg).
- Zip the Blue-j folder and submit via Moodle.
Handson Exam 1
July 23 lecture
Toll lane and EPass example
Seatwork: printing shapes and letters
Shapes.zip
More exercises on printing letters
COS.zip
August 21: Programming "Contest"
Arrays
- Download this BlueJ Project
- Study the different versions of the ReverseInput program
- Study the ThreeBankAccounts program
- Complete the BankAccountArray program
Programs defenses: August 28, 29 and Sep 1 (Room F209)
(No CS 21a classes under Vergara during those days)
Inheritance Lab
Lab6 JCreator template project ;
Instructions .
Sample GUI Handson:
Specs
Calculator Frame Example:
Version 1:
uses multiple listener objects, one per button
Version 2:
uses a single listener object for many buttons
(through ActionEvent)