[Lui's homepage] [CE 21 homepage]
CE 21, First Semester, 2005-2006

Programming Assignment #1:

Write a program in C++ that accepts as input from a user the list of color bands on a resistor and responds with information about the resistance and tolerance of the resistor.

Examples:

If the user inputs
    yellow
    VIOLET
    Red
the program replies that the resistor is a
    4.7K resistor .

If the user inputs
    yellow
    VIOLET
    Red
    gold
the program replies that the resistor is a
    4.7K resistor with 5% tolerance .

If the user inputs
    BROWN
    Red
    gold
    GOLD
the program replies that the resistor is a
    1.2 ohm resistor with 5% tolerance .

The user may type the color names in lowercase, uppercase or any mixture of upper and lowercase letters.

The program should be able to accept different numbers of inputs, and should be able to detect erroneous input (e.g. first band is BLACK, too few bands, inputs that are not proper colors).

This program may be worked on individually or in groups of at most three. Each person shall be individually responsible for the entire program.


[Lui's homepage] [CE 21 homepage]


This page has been accessed
Counter
times since June 15, 2005.

Created June 15, 2005
Last updated June 15, 2005
By Luisito L. Agustin
lui_agustin@yahoo.com

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1