Join Peggy Fisher for an in-depth discussion in this video Solution: Simple calculation, part of Up and Running with Java.
- View Offline
- Exercise Files
(gentle music)…- I hope you had fun with that challenge…but I also wanna say don't be discouraged…if this is your first time…and you found it a little difficult.…What I'd like to do is show you one approach…to solving this.…Again, this is my approach…and it might look a little different than yours.…The first thing that I would do would be…to declare my variables.…There's quite a few in this program.…Let's make them doubles…and I'm gonna start by declaring the width for the house…so I'm gonna make a w, the length L,…and the height, H.…
Next, I'm gonna take care of my windows.…Again, I use double.…We'll call it numWin to represent the number of windows…and I need to know the window width…and the window height.…We need to do the same thing with the doors.…Double numDoors, doorWidth, and doorHeight…because we don't need paint for the doors or the windows.…So, when we calculate our final surface area…we're gonna subtract these values.…Remember, our goal is to find the total surface area…that needs to be painted…so I am gonna go ahead…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.