Today you printed values, named them, updated them and combined numbers with text. This checkpoint asks you to assemble those ideas without copying an example line by line. Spend a few minutes planning before opening a hint.
The brief
You have a daily budget and several identical study sessions. Calculate how many minutes are planned, how many remain, and how many complete extra sessions fit. For this checkpoint, choose a positive session length and a budget at least as large as the planned time. That keeps the remainder and extra-session count nonnegative. You will learn to handle an over-budget plan with decisions on Day 2.
Write down the input values, their units and the formulas separately. Check the formulas on paper with a case that fits exactly and one that leaves a remainder. Avoid putting formulas inside a long chain of concatenation: naming a result helps you inspect it and makes each output statement easier to read.
A different worked situation
The example below counts pages rather than study sessions. Transfer the pattern, not the variable names. A correct output alone is not enough if the answer is hard-coded; changing a starting value must change the derived results.
public class Main {
public static void main(String[] args) {
int pages = 100;
int chapters = 3;
int pagesPerChapter = 20;
int planned = chapters * pagesPerChapter;
int remaining = pages - planned;
System.out.println("Planned: " + planned);
System.out.println("Left: " + remaining);
}
}Check your prediction
Planned: 60
Left: 40 Each computed name describes a distinct quantity. The left value is not a second unrelated input. Change chapters to 5 and explain why the remainder becomes zero.
public class Main {
public static void main(String[] args) {
int leftover = 14;
int block = 5;
System.out.println(leftover / block);
System.out.println(leftover % block);
}
}Check your prediction
2
4 Four leftover minutes cannot make a complete five-minute block. Distinguish complete groups from the approximate decimal quantity. The checkpoint needs complete additional sessions.
Your turn
Build the budget report
Use budget=90, sessions=2 and minutesPerSession=25. Print Planned: 50, Remaining: 40 and Extra sessions: 1 on separate lines. Derive every number. Check budget=50 (remaining 0, extras 0) and budget=100 (remaining 50, extras 2).
public class Main {
public static void main(String[] args) {
int budget = 90;
int sessions = 2;
int minutesPerSession = 25;
// Calculate the report from these inputs.
}
}Hint 1: the idea
There are three calculations, and later ones depend on earlier ones. Work from planned minutes to remaining minutes to complete extra sessions.
Hint 2: a first step
Start by multiplying the number of sessions by the duration of one session. Keep the division for extras until you have the remaining value.
Show one solution
public class Main {
public static void main(String[] args) {
int budget = 90;
int sessions = 2;
int minutesPerSession = 25;
int planned = sessions * minutesPerSession;
int remaining = budget - planned;
int extra = remaining / minutesPerSession;
System.out.println("Planned: " + planned);
System.out.println("Remaining: " + remaining);
System.out.println("Extra sessions: " + extra);
}
}Planned: 50
Remaining: 40
Extra sessions: 1 Change it and explain
Close the solution and rebuild the report with different names and values. For each line, say whether it is an input, a calculation or presentation. Explain what would go wrong if you assigned remaining before planned had its intended value, or used a String for minutesPerSession.
Use this self-check before Day 2: can you make the report, change all three inputs and explain the results without opening a hint? If not, repeat the smallest relevant example rather than rereading the entire day. Return tomorrow and recreate one report from memory; retrieval is useful practice too.
Completion is saved in this browser only. It does not measure mastery.