Join Peggy Fisher for an in-depth discussion in this video Challenge: Simple calculation, part of Learning Java 8.
- This challenge is designed to give you an opportunity to use the skills that you learned in this section. You'll be given an algorithm that describes the steps for calculating the surface area of a house, to determine the amount of paint needed. You are only required to calculate the total surface area of the exterior of the house, but you can extend this challenge by also calculating the gallons needed by asking the user for the amount of coverage area of one gallon of paint. One hint is that don't forget that a house has a front and a back and two sides.
The challenge objectives for this activity is to write a complete Java program, translate algorithm steps into Java, use appropriate data types for variables, prompt the user for information, and print the results. Okay, now let's go over the algorithm. These are the steps needed to paint the exterior of a house. Declare all variables. Ask the user for the house length, the width and the height. Ask for the number and size of the windows.
Ask for the number and size of the doors, because windows and doors do not need to be painted. Finally, calculate the total surface area that will be painted. Okay, that's your challenge. I'm estimating 20 minutes for this activity, but it might take a little longer if you're new to this process. Have fun.
- 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.