The keypad on your oven is used to enter the desired baking


The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone. Unfortunately, the digits 1, 4, and 7 do not work.

1

2

3

4

5

6

7

8

9

 

0

 

When a recipe calls for a temperature that can't be entered (due to keys not working), you want to substitute a temperature that can be entered.

Write a program that takes a desired temperature as an input from the user. The temperature must be between 0 and 999 degrees.

If the desired temperature does not contain 1, 4, or 7, then display the desired temperature. If it contains 1, 4, or 7, compute and display the next largest temperature that doesn't contain 1, 4, or 7.

For example, if the desired temperature is 450, then the program should output 500. Similarly, if the desired temperature is 375, then the program should output 380.

In your program, include and use a function named "containsDigit" declared as below. If the entered number contains a digit, the function should return true. Otherwise, the function should return false.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: The keypad on your oven is used to enter the desired baking
Reference No:- TGS02149381

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)