CS 134: Programming Fundamentals, Summer 2022
Assignment turn-in link: CANVAS TURN IN
Exercises are meant to be solo effort, please try to complete it on your own. You can ask the instructor or a tutor questions if you get really stuck, but all the information you need to complete the assignment is in here, or in the related reading/lectures.
If you get stuck, please post questions in the Unit 2 'Help!' discussion board .
FIRST, from your "My Repls" page on Repl.it create a New folder for this weeks' assignments name it Unit02. Within this folder you will create separate Repl projects for each program. When you turn in the assignments, you will copy the URL to your folder as the submission.
First, make sure all your programs are inside your Unit02 folder. If they're not you can click on the three dots on the right side of the program name and click "Move".
To submit your work, navigate to the folder for your exercises on replit. Copy the URL to that directory (e.g., https://replit.com/@rsingh13?path=folder/Unit02) and paste it in here in Canvas.
PLEASE GIVE YOUR PROGRAMS THE FOLLOWING NAMES:
Clean code also means the ability to find the code itself, so if your project is unkempt and hard to navigate you will lose points.
(This video only shows 2 replit projects created, but this is just an example. Create as many projects as there are programs below.)
Once you've turned in the assignment, make sure to also post your program in the code review assignment, [CS134.U02.PR] 🔎 Python basics – Peer Review
Quick jump: Program 1: Welcomer | Program 2: Sums | Program 3: Area
⭐
This program will ask the user to enter some basic information and then display a welcome message.
Hi Rachel, Welcome to Summer semester, 2022 Looking forward to having you in CS200!!
1. Start off by going to the starter code here: https://replit.com/@rsingh13/CS134U02EX-Program-1#main.py
2. Click on the FORK button () to make a copy of it for your own account.
3. Click the RUN button () to see the program so far.
4. To begin wtih, the program only asks for a name and then says hi:
WELCOMER PROGRAM --------------------------- What is your name? Rachel Hi, Rachel!
We're going to complete the program by asking for additional information. We want to ask the user for the COURSE, the SEMESTER, and the YEAR.
1. Create variables for course, semester, and year. Ask the user to enter
values for each of these using the input
function.
2. After the user is done inputting all the information, add new
print
functions to display a message like this:
WELCOMER PROGRAM --------------------------- What is your name? Rachel What is the semester? Summer What is the year? 2022 What is the course? CS134 Hi, Rachel! Welcome to Summer semester, 2022 Looking forward to having you in CS134!
The values "Rachel", "Summer", "2022", and "CS134" should all come from the variables, so when different people run the program the correct information shows up.
⭐⭐
This program currently takes in 2 numbers and sums them. You will add a third number.
Enter a first number: 1.1 Enter a second number: 2.2 Enter a third number: 3.3 1.1 + 2.2 + 3.3 = 6.6
1. Go to the second program's starter code here: https://replit.com/@rsingh13/CS134U02EX-Program-2#main.py
2. Click on the FORK button to make a copy.
3. Run the program. Currently it takes two numers and adds them together, displaying the result.
SUM! ----------------- Enter a first number: 4.5 Enter a second number: 7.5 4.5 + 7.5 = 12.0
Modify the program to add one additional number. Use the existing code for reference. Your final program output should look like this:
SUM! ----------------- Enter a first number: 4.5 Enter a second number: 7.5 Enter a third number: 1.1 4.5 + 7.5 + 1.1 = 13.1
⭐⭐⭐
This program you will design and implement on your own.
The program will ask for the following information:
The program will also calculate the following information, given that information:
And it should display all the information in a nice "Receipt" like format.
RECEIPT --------------------- What is the name of the first item? Burrito What is the price of the first item? 1.29 What is the name of the second item? Quesadilla What is the price of the second item? 3.10 What is the tax rate? 0.09 RECEIPT Burrito $1.29 Quesailla $3.10 Subtotal $4.39 Tax $0.40 Total $4.79
Start by designing the program. Use a tool like
Dia or draw on paper, but create a flow chart to outline
each of the steps needed.
Export your diagram as a PNG or JPG file and make sure to upload
it into the corresponding replit project:
If you get stuck, you can post in the 💬 Unit 2 help - Discussion board to brainstorm with your classmates or get hints from the instructor.
Write the program in Python and make sure to test it out. It should also have an easy-to-follow user interface.
You can format currency using a command like this:
print( name1 + " \t" + "${:,.2f}".format( price1 ) )