# Module 1 Coding Practice¶

Update the main method in `RectangleTest` to calculate and print the perimeter of a rectangle having width 7 and height 9. Add another statement to calculate and print the area of the rectangle on a separate line.

Update the main method in `TriangleTest` to calculate and print the area of a triangle with base 7 and height 9. Recall the formula is 1/2bh. Your solution must contain at least one multiplication and one division. Watch out for integer division! int/int results in an int, while int/double results in a double.

R0 (pronounced R-naught) is a measure for predicting and controlling the transmission of disease. If R0 is 3, then each person that has a disease will spread it on average to 3 other people. The program below shows 4 iterations in the spread of SmallPox, which has an R0 of 3. The first person spreads to 3 people, each of whom spread to 3 people, etc. Update the `R0Spread` program with additional print statements to show the spread after 4 iterations of HIV (R0 of 4) and Measles (R0 of 16).

The `Test1` program should print “Gabby’s favorite sport is soccer”. However, the code has errors. Fix the code so that it compiles and runs correctly.

The `Test2` program should print “Your name is Carly and your favorite color is red”. Finish the code so that it prints the output correctly using the variables provided.

Finish the `Test3` program so that it prints “Your name is Justin and your age is 16” using the variables provided.

Open the `Test4` program. Write the code to print “Julian’s favorite color is green. His favorite food is pizza.” using the variables provided. Watch out for spaces and the period at the end of each sentence.

Finish the `Test5` program to print your favorite movie and book.

The `Test6` program should calculate the cost of a trip that is 300 miles if gas is \$2.50 a gallon and your car gets 36 miles per gallon. However, the code has syntax errors, like missing semicolons, wrong case on names, or unmatched `"` or `(`. Fix the code so that it compiles and runs correctly.

The `Test7` program should calculate the number of miles that you can drive when you have \$8.00 and the price of gas is 2.35 and the car gets 40 miles per gallon. However, the code has errors. Fix the code so that it compiles and runs correctly.

The `Test8` program should calculate the cost of an item that is on clearance (70% off) when you also have a coupon for an additional 20% off the clearance price. However, the code has errors. Fix the code so that it compiles and runs correctly.

The `Test9` program should calculate the number of whole days in 320893 seconds. However, the code has errors. Fix the code so that it compiles and runs correctly.

Complete the `Test10` program to calculate and print how many months it will take to save \$200 if you earn \$20 a week. First calculate how many weeks it would take to make \$200, then calculate how many months it will take assuming there are 4 weeks per month.

Complete the `Test11` program to calculate the number of miles you can drive if you have a 10 gallon gas tank and are down to a quarter of a tank of gas and your car gets 32 miles per gallon.

Complete the `Test12` program to calculate the number of seconds in 3 days. Remember that there are 60 seconds in a minute and 60 minutes in an hour and 24 hours in a day.

Complete the `Test13` program to print the number of chicken wings you can buy if you have \$4.50 and they cost \$0.75 each. Remember that you can’t buy part of a wing. Divide the amount of money you have by the cost of each wing and then use casting to set the result to an int since you can’t buy a part of a wing.