Sale!

Assignment 1 Variables, Calculations and Branching

$30.00

Category:
Rate this product

COMP 1005/1405
1
Assignment 1
Variables, Calculations and Branching

Problem 1 (Algorithm Design)
Create an algorithm for playing a guessing game where the user tries to guess a random
number x between 1-100. You can assume that a variable called x already exists and has been
initialized to some random value between 1 and 100. Your algorithm only needs to handle
getting guesses, giving hints, and determining whether the game is over or should continue.
After each incorrect guess, a hint should be given to the user indicating whether they should
guess higher or lower. The game should repeat until the user guesses the correct number.
Do not worry too much about specific terminology – as long as someone with absolutely no
knowledge about what the game is can read through your algorithm and play the game
correctly, your algorithm is good. Save your algorithm in a text file called a1q1.txt and add it to
your assignment1.zip file.
Problem 2 (Bill Calculator)
Write a program that computes a total amount to pay for a bill. Your program will prompt the
user for the subtotal of the bill and the tip percentage (e.g., 15%) desired. Your program will
then calculate and print out the total of the bill (subtotal and tip). Your program should be
capable of handling decimal values for the subtotal and integer values for the tip percent. You
do not have to worry about formatting the final total number correctly (e.g., it can have additional
decimal places). Example output:
Enter the bill subtotal: 100.00
Enter the tip percentage: 15
The total bill is $115
Enter the bill subtotal: 63.57
Enter the tip percentage: 20
The total bill is $76.284
Test your code to make sure it is working correctly. Save your code in a file called a1q2.py and
add it to your assignment1.zip file.
COMP 1005/1405 – S17 – A1 Due Sunday, May 14th at 11:55 PM
2
Problem 3 (Grade Calculations)
Write a program that computes the final grade for a student. Your program will prompt the user
for the following input: assignment grade, midterm grade, tutorial grade, and final exam grade.
Each grade is a percentage between 0 and 100 and may contain decimals (e.g., 83.5). The final
grade should be calculated using the following weights:
Assignments 50%
Midterm 15%
Tutorials 5%
Final Exam 30%
To pass the course, the student must have a final grade of 60% or higher and have received at
least 50% on the final exam. Your program must print out two statements indicating the final
grade the student received and whether the student passed the course or not.
Save your Python program in a file called a1q3.py and add it to your submission zip file.
Recap
Your zip file should contain your a1q1.txt, a1q2.py, a1q3.py files.
Submit your assignment1.zip file to cuLearn.
Make sure you download the zip after submitting and verify the file contents.

Open chat
Need help?
Hello
Can we help you?