CS201
Lab 9 - String Practice
WELCOME BACK! TIME FOR A "WARM-UP" LABORATORY...
:)
Objectives:
- Calculate the value of a resistor given its color bands,
using a C program.
Readings:
- Read Chapter 9 in the Hanly/Koffman text.
Deliverables: (DUE BY THE END OF YOUR LAB ON 3/28 & 3/29!)
- Submittal of the following files:
- Makefile
- Proto.h
- Lab8.c
- Search.c
TO DO (for this lab)
- Design and Write a program to solve Programming Project #2
on page 495-497 of the Hanly/Koffman text.
- Be sure your Makefile will properly rebuild the run image.
- Inputs: Calculate the resistances of the following 5 resistors.
- green-black-yellow
- brown-violet-blue
- brown-black-orange
- red-red-green
- green-orange-red
- In addition, I will test a few other unknown resistor
values.
- (on Screen) Sample Run:
CS201 - Lab 9 - Resistor Calculator
Enter the colors of the resistor's three bands,
beginning with the band nearest the end. Type
the colors in lowercase letters only, NO CAPS.
Band 1 => blue
Band 2 => black
Band 3 => red
Resistance value: 6000 ohms
Do you want to decode another resistor ?
y
CS201 - Lab 9 - Resistor Calculator
Enter the colors of the resistor's three bands,
beginning with the band nearest the end. Type
the colors in lowercase letters only, NO CAPS.
Band 1 => red
Band 2 => black
Band 3 => yellow
Resistance value: 200 kilo-ohms
Do you want to decode another resistor ?
n
Helpful Hints
- Note: Check for the value of the resistance to be greater
than 10000 ohms. Print kilo-ohms for values > 10000 ohms.
Print ohms for valuse ≤ 10000 ohms.
- If you decide that you need to pass strings to function(s). Make sure to declare
important input-only parameters as constant variables.
- Remember the output redirection does not reflect input
values, so be sure to check the following files for
example formats.