219k views
0 votes
The jackpot of a lottery is paid in 20 annual installments. There is also a cash option, which pays the winner 65% of the jackpot instantly. In either case 30% of the winnings will be withheld for tax. Design a program to do the following. Ask the user to enter the jackpot amount. Calculate and display how much money the winner will receive annually before tax and after tax if annual installments is chosen. Also calculate and display how much money the winner will receive instantly before and after tax if cash option is chosen.

User Margherita
by
4.3k points

1 Answer

4 votes

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// variables

double jack_amount;

int choice;

double before_tax, after_tax;

cout<<"Please enter the jackpot amount:";

// read the amount

cin>>jack_amount;

cout<<"enter Payment choice (1 for cash, 2 for installments): ";

// read the choice

cin>>choice;

// if choice is cash then find the instant amount before and after tax

if(choice==1)

{

before_tax=jack_amount*.65;

after_tax=(jack_amount*.70)*.65;

cout<<"instantly received amount before tax : "<<before_tax<<endl;

cout<<"instantly received amount after tax : "<<after_tax<<endl;

}

// if choice is installments then find the each installment before and after tax

else if(choice==2)

{

before_tax=jack_amount/20;

after_tax=(jack_amount*.70)/20;

cout<<"installment amount before tax : "<<before_tax<<endl;

cout<<"installment amount after tax : "<<after_tax<<endl;

}

return 0;

}

Step-by-step explanation:

Read the jackpot amount from user.Next read the choice of Payment from user.If user's choice is cash then calculate 65% instantly amount received by user before and after the 30% tax.Print both the amount.Similarly if user's choice is installments then find 20 installments before and after 30% tax.Print the amount before and after the tax.

Output:

Please enter the jackpot amount:120

enter Payment choice (1 for cash, 2 for installments): 1

instantly received amount before tax : 78

instantly received amount after tax : 54.6

User Wilbur
by
4.8k points