CS 115 Lab 2
Introduction to Mathematical Operators and Test Cases (Team)
Due date: Monday September 11, by the end of your lab period.
Team submit link Submit your team's file with this link.
Use the Lab 2 menu choice.
Educational goals of this lab - verify that every student can
- gotten the email addresses of the team members and send a list to the TA
- work with their teammates to finish a project
- practice with mathematical operators
- begin to understand the testing process
- (10 points) Team Problem #1:
- Everyone on the same team should sit together. You will be working together.
Exchange email addresses so that you can communicate with your team outside of lab.
One member emails your TA with a list of the students on your team and their email addresses.
Make sure to include which Team number (1-6) you are!
- (70 points total) Team Problem Introduction: Converting bits to bytes and kilobytes
- The program you are creates converts bits to bytes and kilobytes.
Note that this is NOT converting binary to decimal!
The output should look exactly like:
Enter a number of bits: 256
There are 0 kilobytes and 32 bytes and 0 bits left over in 256 bits
That is 0 * 1024 * 8 + 32 * 8 + 0 bits = 256 bits
Enter a number of bits: 50000
There are 6 kilobytes and 106 bytes and 0 bits left over in 50000 bits
That is 6 * 1024 * 8 + 106 * 8 + 0 bits = 50000 bits
Enter a number of bits: 350
There are 0 kilobytes and 43 bytes and 6 bits left over in 350 bits
That is 0 * 1024 * 8 + 43 * 8 + 6 bits = 350 bits
- (20 points) Team Problem #2: Writing Test Cases
Figure out what goes in each of the blanks in the table below. Use a calculator as needed. Calculate these FIRST, before writing the program!
Using your program to get these answers means that you have not tested your program at all!
Put them into a file called testcases2.txt.
Put your Section number and Team number at the top of the file. Label each answer with its letter.
Your answers don't have to include the input prompts. Just give the two lines of output for each case.
(number of bits)
|Input giving 0 kilobytes, non-zero bytes, 0 bits|| 1000 ||___A.___|
|Input giving non-zero kilobytes, 0 bytes, non-zero bits||16389 ||___B.___|
|Number of bits is zero||0|| ___C.___|
|Only the number of bits left over is non-zero||7 ||___D.___|
|All results are non-zero||10753||___E.___|
- Submit your text file with the link above.
Use the Lab 2 menu choice and "Other" as the type.
- (50 points) Team Problem #3: Writing the program
If you do not attend lab, you will NOT get
the points for the Team Problem, even if your team does submit a solution!
Make sure you sign the attendance sheet.
Remember NOT to leave files
on the local hard drives on University computers.
campus! Make sure you save your projects onto a portable
storage device you take with you!