Practice Programs
Practice Programs can generally be solved with a short program that directly applies the programming principles presented in this chapter.
Write a program that reads three whole numbers and displays the average of the three numbers.
Write a program that uses
Scanner toread two strings from the keyboard. Display each string, along with its length, on two separate lines. Then create a new string by joining the two strings, separated by a blank. Display the new string and its length on a third line.Write a program that reads the amount of a monthly mortgage payment and the amount still owed—the outstanding balance—and then displays the amount of the payment that goes to interest and the amount that goes to principal (i.e., the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access