Skip to main content
Java Active Learning WorkBook:
Scaffolded Programming Activities Beyond The Basics.
Celine Latulipe, Devon Blewett, Lara De Leon
Contents
Search Book
close
Search Results:
No results.
Prev
Up
Next
Profile
Course Home
Assignments
Practice
Peer Instruction (Instructor)
Peer Instruction (Student)
Change Course
Instructor's Page
Progress Page
Edit Profile
Change Password
Log Out
Front Matter
chevron_left
Preface
Colophon
1
Java Basics
chevron_left
1.1
Basic Program Structure
1.1.1
Exercise 1
1.1.2
Exercise 2
1.2
Data Types & Operators
1.2.1
Brief Review of Data Types
1.2.2
Built-in Mathematical Operators
1.2.3
Type Conversion
1.2.4
Exercise 1
1.2.5
Exercise 2
1.2.6
Exercise 3
1.2.7
Exercise 3
1.3
Enumerators
1.4
Methods
1.5
Formatting Console Output
1.6
Console Output via Scanner
1.7
Conditionals
1.8
Switch Statements
1.9
Loops
1.10
Math & String Methods
1.11
Arrays
2
Objects Basics
3
Objects Intermediate
4
Strings
5
File I/O
chevron_left
5.1
Starter Level
5.1
Exercises
5.2
Growth Level
5.3
Stretch Level
6
Exception Handling
chevron_left
6.1
exception one
6.2
exception two
7
ArrayLists
chevron_left
7.1
Check Your Understanding
7.1
Exercises
7.2
Starter Level
7.2.1
Instructions
7.3
Growth Level
7.3.1
Overview
7.3.2
Instructions
7.4
Stretch Level
7.4.1
Overview
7.4.2
Instructions
8
Wrapper Classes
chevron_left
8.1
Check Your Understanding
8.1
Exercises
8.2
Starter Level
8.2.1
Overview
8.2.2
Instructions
8.3
Growth Level
8.3.1
Overview
8.3.2
Instructions
8.4
Stretch Level
8.4.1
Overview
8.4.2
Instructions
9
Searching
10
Sorting
chevron_left
10.1
starter
10.1.1
10.2
second
10.3
third
11
Recursion Intro
chevron_left
11.1
recursion one
12
Recursion Advanced
chevron_left
12.1
advancedrec one
13
Multidimensional Arrays
chevron_left
13.1
Starter Level
13.1.1
Overview
13.1.2
2D Array
13.1.3
Instructions
13.2
Growth Level
13.2.1
Overview
13.2.2
2D Array
13.2.3
Instructions
13.3
Stretch Level
13.3.1
Overview
13.3.2
Instructions
14
Linked Lists
15
Interfaces
16
Abstract Data Types
Backmatter
🔗
Section
12.1
advancedrec one
🔗
Coin count problem
import java.util.Arrays; public class Main{ // recursive function to count the number of possible solutions static int coinCounter(int coins[], int size, int sum) { // if the sum is 0, increment the number of solutions // If sum is less than 0 then this is not a valid solution // if there are no coins and the sum is still greater than 0, there is no solution // recursive step - return the count with the current coin + the count with the next coin minus the value of the current coin } public static void main(String args[]) { int coins[] = {2, 4, 5}; int goal = 12; int size = coins.length; System.out.println(coinCounter(coins, size, goal)); } }
You have attempted
1
of
2
activities on this page.