Unit 1 Write Code for Toggle Code¶
This is the write code problems associated with the mixed up code problems.
Write code that prints Maria’s first name on one line and her last name on the next line.
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.
Write code that prints Marcus’s name on one line and his favorite color (Blue) on the next line.
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.
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.
Write code that calculates and prints the number of seconds in 5 days.
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.
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
.
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
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.
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.
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.
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.
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.