Hey guys, I have a homework assignment due and my teacher doesn't teach us anything, I have no idea where to start.
If anyone can help I would really appreciate it, its due at midnight EST
HW2. Integrated Circuit Manufacturing -- for loop version
Using only the for construct for looping, devise code that computes the increase in size along a dimension of a growth medium off of an Integrated Circuit substrate. The growth rate equation to be used is: xt = x0 * (1+r)^t, where x0 is the initial value of x, xt is the value of x after time t, r is the percentage growth in a time period (seconds) and t is the time period. Note: '^' is not a valid C++ construct and must be calculated in another fashion (hint: x0 times t number of (1+r)'s).
Given variables:
1) char dopantType -- Input by user. Allowable options 'A', 'B', 'C', 'D', '0' for null
2) float stopTime -- Input by user. Allowable range is 10.0 to 200.0
3) float x0 -- Derived by program from user choice. Allowable range is 0.1 to 100.0
4) float rate -- Derived by program from user choice. Allowable range is 0.1 to 0.5
5) float xt -- Calculated by the program given the above equation.
The constraints to derive variables #3 and #4 are as follows:
-The values of x0 are the following for a given dopantType (dopantType,x0):
(A,0.1),(B,2.0),(C,4.0),(D,6.0),(0,0.0)
-The values of rate are the following for a given dopantType (dopantType,rate):
(A,0.1),(B,0.3),(C,0.2),(D,0.4),(0,0.0)
Using only the for construct for loops, develop code that performs the following tasks:
1) Read user inputs. Be sure to bounds check them for validity and if any are out of bounds print an error statement and loop until the inputs are valid.
2) Calculate derived variable.
3) Calculate xt at the stop time.
4) Print out all variables.
5) Print out if xt at stop time is greater than 20 or is less than or equal to 20
Be sure to test your code with the following input cases (assuming dopantType input first):
1) A 10
2) F G B 10
3) C 5 10
4) D 10
5) D 50
6) D 100
7) D 150
8) D 200
this is what I have right now, no idea if its right or not.
#include <iostream>
using namespace std;
int main ()
{
char dopantType = 0;
float stopTime = 0;
float x0 = 0;
float rate = 0;
float xt = 0;
switch(dopantType)
{
case 'A':
x0 = 0.1;
rate = 0.1;
break;
case 'B':
x0 = 2.0;
rate = 0.3;
break;
case 'C':
x0 = 4.0;
rate = 0.2;
break;
case 'D':
x0 = 6.0;
rate = 0.4;
break;
default:
x0 = 0.0;
rate = 0.0;
break;
}
}