In: Computer Science
For this program you will be looking at future tuition at your university. In 2020, the tuition for a full time student is $6,549 per semester, the tuition for a part time student is $3,325. The tuition will be going up for the next 7 years at a rate of 3.5% per year. Write a program using if-else and a loop. Ask the user if they are a full time or part time student, then display the projected semester tuition for the next 7 years. You should display the actual year (2021, 2022, through 2027) and the tuition amount per semester for that year.
Here is the c/c++ code, if the code is required in any other language (java, python) put it in the comments:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Main funtion
int main()
{
    char choice;
    //ask the user
    printf("Are you a full time or part time student?(f/p): ");
    //input the choice
    scanf("%c", &choice);
    //if it is full time make the fees as 6549
    if (choice == 'f')
    {
        printf("The fess thorugh the years is\n");
        float fees = 6549;
        int i, year = 2020;
        for (i = 0; i < 7; i++)
        {
            //print the year(also increment it) and the fees
            printf("Year %d: %f\n", year++, fees);
            fees += (3.5 * fees / 100);
        }
    }
    else if (choice == 'p')
    {
        printf("The fess thorugh the years is\n");
        float fees = 3325;
        int i, year = 2020;
        for (i = 0; i < 7; i++)
        {
            printf("Year %d: %f\n", year++, fees);
            fees += (3.5 * fees / 100);
        }
    }
    else
        printf("Wrong choice entered\n");
    return 0;
}
Here is the output of the above code: