This video explains a solution to creating a bank account program in Scala. The solution includes creating a bank account class and a singleton object that is used to keep track of the next account number to be assigned.
- [Narrator] How did you make out with the last challenge?…I hope you had fun with it.…I'm going to go ahead and show you how I…would approach this problem.…I'm going to start by creating a new Scala project.…And I'm going to call it Bank Account.…And then, inside the source file, I'm going to add a new…Scala app, and I'll call it, let's just call it account.…Alright, so I know that I need to add a class…that's going to be representative of a bank account,…and the bank account is going to need to have the client name,…the balance ...…
And the type of account, whether it's a checking account…or a savings account.…I'm going to try and make it simple,…I'm going to call it type, and I'm going to make it a character,…and I'm going to default it to checking, because most…of the accounts that get created…are probably checking accounts.…Type is actually a keyword, so I have to change this…from type to something a little bit different, so let's…call it type of account, there we go.…That's better.…Right, inside of my bank account, I can add…
Join Peggy Fisher as she helps get you started with Scala, so you can leverage the unique capabilities it offers. First, learn the basics of type inference, variables, loops, functions, and operators. Then, find out how to read files using a console, perform pattern matching, handle exceptions, and more. Finally, learn how to use classes, fields, methods, and objects.
- Integrating with IDEs
- Scala worksheets
- Scala repl sessions
- Type inference
- Creating variables
- Working with loops
- Higher-order functions
- Scala operators
- Working with decision statements
- Handling exceptions using try or catch
- Working with tuples and arrays
- Classes, fields, and methods
Skill Level Intermediate
Java Platforms Compared: SE vs EE vs MEwith Peggy Fisher25m 38s Intermediate
1. Getting Started with Scala
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.