In: Computer Science
Lottery jackpot winners usually elect to take a lump sum payment of their winnings, on which they pay federal taxes and receive the rest. Design a lottery calculator program that:
a. Allows the user enter the
1. Lump sum payment of the winnings
2. The percentage tax to be paid on those
3. The user will invest the remaining money received, so allow them to enter the percentage return they expect to get each year on their investment.
4. The average life expectancy of the user (up to what age they expect to live)
5. The user's current age
6. How much money they expect to spend each year.
b. Calculates and outputs
1. The amount of money the user will receive from the lottery after taxes
2. A yearly schedule that shows
i The year number
ii How much money their investment earned that year
iii How much money will remain after their expenses for that year
3. Outputs this yearly schedule until the user reaches their expected age from (a)(4) above or their money runs out.
Pseudocode:
1) Initialise variables as
float lump sum,tax, returnex, life,currentage,expenditure,receive,earned,left;
int i,year,returnlife;
2) Prompt user for various input values :
printf("Enter the lump sum payment of winnings");
scanf("%f",&lumpsum);
printf("Enter the tax percent");
scanf("%f",&tax);
printf("Enter the average life expectancy");
scanf("%f",&life);
printf("Enter Current Age");
scanf("%f",¤tage);
printf("Enter the expected return");
scamfnf("%f",&returnex);
printf("Enter the expected expenditure");
scanf("%f",&expenditure);
after = (lumpsum*tax)/100; //calculating money left after paying tax
3) printf("Money Received = %f",lumpsum);
printf("Money left after paying tax = %f",after);
returnlife = life - currentage;
4) for(i=1 ; i<=returnlife ; i++) //outputs will be shown until the expected life is reached
{
year = i ;
earned = (lumpsum*returnex)/100; //calculating amount of return expected
left = earned - expenditure; //calculating amoubt left
prinf("Year = %d",year);
printf("Earned amount = %f",earned);
printf("Amoubt left with them = %f",&left);
}