Volume
General
- All submissions must include a work history to earn credit.
- Make sure your program accepts input in exactly the order and format specified. Do not ask for extra input or change the order of inputs. (If you want to make an expanded version of a program and get feedback on it, email it to me or show me in person.)
- Output the requested information in the specified order. Slight variations in output wording/formatting are usually fine, as long as formatting isn't part of the assignment. If you cannot get the right final output, print out some evidence of the work your program did to demonstrate your progress.
- Readability and maintainability of your code counts. Poor formatting, confusing variable names, unnecessarily complex code, etc. can result in deductions from your score.
Objective
Upon completion of this assignment, the student will have a working C++ development environment and be able to write a program that does simple numeric calculations and console input and output.
Assignment Instructions
About CS161 Assignments
Begin by reviewing the purpose and requirements of CS161 assignments. That overview describes how to manage a key part of the assignments—your work history.
Requirements / Scoring
This assignment is more about demonstrating you understand the expectations for CS161 assignments as it is about the actual code you write. Read the rubric in Canvas carefully to make sure you understand what we are looking for.
Setup
It is assumed that you will use a codespace to do this assignment.
Start with the Basic Project template. Name the repository you create something like assign1. Make your codespace from that repository.
Description
Rather than write 5 teaspoons, we could express the same volume as 1 tablespoon and 2 teaspoons. Rather than write 200 teaspoons, we could express the same volume as 1 quart, 2 tablespoons, and 2 teaspoons.
Write a program that prompts the user for a number (integer) of teaspoons and then expresses that volume in terms of quarts, cups, tablespoons, and teaspoons.
There are 3 teaspoons per tablespoon, 16 tablespoons per cup, and 4 cups per quart.
If the user wants to convert 87 teaspoons, this is what running your program should look like (with user input highlighted, and other text printed by the program).
Enter the number of teaspoons: 87
0 quart(s)
1 cup(s)
13 tablespoon(s)
0 teaspoon(s)With 1234 teaspoons, this is what you should see.
Enter the number of teaspoons: 1234
6 quart(s)
1 cup(s)
11 tablespoon(s)
1 teaspoon(s)Details / Tips
You do not need to worry about invalid input. Your program will only be tested with valid whole number values between 0 and 100000.
Submission
Submit file: project.zip
For each assignment, you will submit a .zip archive of your project folder including all its contents. That way you will submit not just your program, but your work history as well.
See the codespace guide for instructions on how to create a .zip file of your project.