A Problem Solved: Apples by the Box
In this lesson, we will write a Java program to compare the cost of buying apples individually and by the boxful.
We'll cover the following...
Problem statement
You’re driving your car with your favourite person and spy a roadside stand. You stop and find a farmer who is selling apples individually and by the box. You buy a box of apples. How much would the apples have cost if you had bought the same number individually? How much did you save, if anything, by buying at the box rate?
Discussion
We really have two problems here, so let’s begin by answering the first question: How ...