Write a program that declares a variable to hold the number of teaspoons in a tablespoon (1 tablespoon = 3 teaspoons).

Assignment

Write a program that declares a variable to hold the number of teaspoons in a tablespoon (1 tablespoon = 3 teaspoons).

Also declare a variable to represent the number of teaspoons needed for a recipe —for example, 16.

Compute the number of tablespoons and remaining teaspoons needed.

Then display explanatory text with the values calculated. Save the program as TablespoonConverter.java.

Here is an example of what the output should look like:

A recipe that needs 16 teaspoons requires 5 tablespoons and 1 teaspoon.

The following input values should be used to test your program and verify the output:

Test ID

Input Values

Output Values

1

16 teaspoons

5 tablespoons and 1 teaspoon

2

8 teaspoons

2 tablespoons and 2 teaspoons

3

24 teaspoons

8 tablespoons and 0 teaspoons

Write a program that declares a variable to hold the number of teaspoons in a tablespoon (1 tablespoon = 3 teaspoons).
Scroll to top