# Toggle Code Practice 1a (1.1-1.6)

Each coding exercise has its own folder. Open its `.java` file and press **Run** to try it. **Run Tests** checks every graded exercise in this lesson at once.

For each of the coding problems below, write your own solution.

## Exercise 1

Write code that prints Maria’s first name on one line and her last name on the next line.

> Open the `01-u1a-toggle1` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 2

Write code that prints the poem `Roses are red` `Violets are blue` `Sugar is sweet` `And so are you` with 1 sentence on each line.

> Open the `02-u1a-toggle2` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 3

Write code that prints Marcus’s name on one line and his favorite color (Blue) on the next line.

> Open the `03-u1a-toggle3` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 4

Write code that figures out the cost for each shirt if you buy 2 and get the third free and they are originally $45 each. Make sure your answer is a double.

> Open the `04-u1a-toggle4` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 5

Write code that figures out the cost per person for a dinner including the tip. Assume the bill was $89.23, there are three people, and the tip should be 20%. Make sure your answer is a double.

> Open the `05-u1a-toggle5` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 6

Write code that calculates and prints the number of seconds in 5 days.

> Open the `06-u1a-toggle6` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 7

Write code that calculates and prints the number of months it would take you to save $500 if you make $50 a week. Make sure your answer is a double.

> Open the `07-u1a-toggle7` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 8

Write code that prints the name on one line followed by the age on the next line. Your output should look like `Your name is Layla` and `Your age is 16`.

> Open the `08-u1a-toggle8` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 9

Write code that prints the name on one line and the favorite food on the next line. Your output should look like:

```
Your name is Julian
Your favorite food is chicken wings
```

> Open the `09-u1a-toggle9` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 10

Write code that calculates and prints the cost of a trip that is 200 miles when the price of gas is 2.20 and the miles per gallon is 42. Make sure your answer is a double.

> Open the `10-u1a-toggle10` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 11

Write code that calculates how many miles you can go on half a tank of gas if the miles per gallon is 26 and your tank holds 15 gallons.

> Open the `11-u1a-toggle11` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 12

Write code that calculates and prints how many chicken wings you can buy with $3.50 if the wings are $.60 each. Make sure your answer is an integer.

> Open the `12-u1a-toggle12` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (2 tests).

## Exercise 13

Write code that calculates how much you will have to pay for an item that is 60 percent off the original price of $52.99.

> Open the `13-u1a-toggle13` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (1 test).

## Exercise 14

Write code that calculates and prints how much the per item costs is for shorts that are buy 2 and get the third free. The shorts are $39.99 each.

> Open the `14-u1a-toggle14` folder and edit `Test1.java`. Press **Run** to try it; **Run Tests** checks it (3 tests).
