Test 1 Preparation CSCI 151

Question 1 (25 points):

For the program below, write calculations performed on each line and write the final output. Explain the order of arithmetic operations in 5th statement. You can write your answer on the paper or as a comment for Question 2 program


x = "Java" + "Test"
y = "Test" + "Java"
a = 157 // 10
b = 23 % 10
e = a + b % 2
print(x)
print(y)
print(e)

Question 2 (75 points):

Instructions: login to your account. Stay in your HOME directory. Write the program in file called test1.py

The person is purchasing apples and apple pies in the store. Write the program that reads the number of pounds and price per pound for apples, the number of pies and price of one pie, and the tax (integer). The program finds and prints the total purchase price. For example, if the person purchased 3 pounds of apples, 1.99 per pound, and 2 apple pies, 7.99 each, and the tax is 6%, the total purchase price is: 23.27 dollars.

If you are having difficulties with tax calculations, you can solve it WITHOUT tax (just assume we are in NJ and no tax on food). Points reduction for this option is -5 points (max grade for this question will be 70 points)

Submission Instructions: