I have been trying to figure out why the assignment operator for my total1-4 variables are not working. can anyone help?
Code:#include <stdio.h>
int main ()
{
int age, crntAdrs, anlIncome, sameJob; // The four factors that will determine credit worthiness
char letter; // If applying for credit card, Y or N
int total1, total2, total3, total4; // Variable for points issued
int pointTotal; // Total of total1-4
printf("\n\nHello, you have chosen to apply for a credit card");
printf("\nwith ACME Banking & Trust.");
printf("\n\nIf this is correct, press \"Y\" for Yes or \"N\" for No: ");
scanf("%c", &letter);
if (letter == 'Y' || letter == 'y')
printf("\n\nGreat, let's continue!"); // The consumer chose to apply
else {
printf("\n\nYou are free to exit the program."); // The consumer did not choose to apply
return 0;
}
//do {
printf("\n\nPlease enter your age: ");
scanf("%d", &age);
if ( age < 18 || age > 105) { // Input validation
printf("\n\nYou have entered an age that is out of range.");
printf("\n\nPlease enter an age in the range of 18 to 105 years.");
}
else { // Determine number of points based on age
if ( age <= 20 )
total1 = -10;
else if ( age > 20 || age <= 30 )
total1 = 0;
else if ( age > 30 || age <= 50 )
total1 = 20;
else if ( age > 50 )
total1 = 25;
}
// } while ( age < 18 || age > 105);
printf("%d", &total1);
//do {
printf("\n\nHow many years have you lived at your current address? ");
scanf("%d", &crntAdrs);
if ( crntAdrs <= 0) {
printf("\n\nThe amount of time you entered is out of range.");
printf("\n\nEnter an amount of time greater than or equal to 1 year.");
}
else { // Determine number of points based on time at current address
if ( crntAdrs < 1 )
total2 = -5;
else if ( crntAdrs == 1 || crntAdrs <= 3 )
total2 = 5;
else if ( crntAdrs == 4 || crntAdrs <= 8 )
total2 = 12;
else if ( crntAdrs == 9 || crntAdrs >= 9 )
total2 = 20;
}
//} while ( crntAdrs <= 0);
//do {
printf("\n\nWhat is your annual income? ");
scanf("%d", &anlIncome);
if ( anlIncome <= 0 )
printf("\n\nThe income amount you entered is out of range.");
else { // Determine number of points based on annual income
if ( anlIncome < 15000 )
total3 = 0;
else if ( anlIncome > 15000 || anlIncome <= 25000 )
total3 = 12;
else if ( anlIncome > 25000 || anlIncome <= 40000 )
total3 = 24;
else if ( anlIncome > 40000 )
total3 = 30;
}
//} while ( anlIncome <=0);
//do {
printf("\n\nHow long have you been employed? ");
scanf("%d", &sameJob);
if ( sameJob <= 0 )
printf("\n\nThe employment time frame you entered is out of range.");
else { // Determine the number of points based on the length of employment
if ( sameJob < 2 )
total4 = -4;
else if ( sameJob >= 2 || sameJob <= 4 )
total4 = 8;
else if ( sameJob > 4 )
total4 = 15;
}
//} while ( sameJob <= 0 );
printf(" total l is %d ", &total1);
printf(" total 2 is %d ", &total2);
printf(" total 3 is %d ", &total3);
printf(" total 4 is %d ", &total4);
pointTotal = ( total1 + total2 + total3 + total4 ); // Total number of credibility points
if ( pointTotal == -19 || pointTotal <= 20 ) {
printf("\n\nYour point total for credit worthiness is %d.", pointTotal);
printf("\n\nWe're sorry, at this time we are not able to offer you");
printf("\ncredit with us.\n\n");
}
else {
if ( pointTotal == 21 || pointTotal <= 35 ) {
printf("\n\nYour point total for credit worthiness is %d.", pointTotal);
printf("\n\nCongratulations! You have been granted a $500 credit limit!\n\n");
}
else if ( pointTotal == 36 || pointTotal <= 60 ) {
printf("\n\nYour point total for credit worthiness is %d.", pointTotal);
printf("\n\nCongratulations! You have been granted a $2000 credit limit!\n\n");
}
else if ( pointTotal == 61 || pointTotal <= 90 ) {
printf("\n\nYour point total for credit worthiness is %d.", pointTotal);
printf("\n\nCongratulation! You have been granted a $5000 credit limit!\n\n");
}
}
}