Join Peggy Fisher for an in-depth discussion in this video Challenge: Hospital stay, part of Learning Java (2015).
- Okay, it's time again for our challenge. The challenge objectives for this section are to add decision-making logic and use a loop to allow the program to continue multiple times. You want to write a program that computes and displays the total charges for our patient in a hospital stay. The patient might be admitted overnight. For an overnight stay, you're going to ask the user for the hospital overnight charges, as well as medication charges and lab service charges.
If it's not an overnight stay, then you're just going to have medication charges and lab service charges. You're going to calculate the charges, print the final total, then ask the user if they want to calculate the charges for another patient. I've estimated 20 minutes for this activity, but it might take you a little longer, or you might get it done a little sooner, but either way, 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.