Student Car Purchase

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

You have $30,000 in credit. Can you buy the $25,000 Miata?

Answer:

Yes. You have enough credit for the car.

Student Car Purchase

Recall the problem:

You would like to buy a new $25,000 red Miata sports car. You can pay in cash, or you can buy it on credit.

It turns out that you actually have $240 on hand and are an unemployed student majoring in philosophy. The credit manager is unwilling to extend any credit to you.

QUESTION 16:

You have $240 on hand and no credit. Can you buy the $25,000 Miata?