Answer to Question #205001 in C++ for fawad Arif

Question #205001

. The prize scheme software must have the following fea￾tures:

1. Registration Module

1. It Includes biodata entry.

2. First Name

3. Last Name

4. CNIC

5. Contact

6. Address

7. Challan No.

8. Challan No. is auto generated (i.e., use ++ operator) and it must be unique.

2. Monthly Installment Entry

In this module the clerk would enter the information. The record must be entered with CNIC 

(the clerk would enter the CNIC number and amount received). Every registered member must

pay the installment.

3. Lucky draw Module

This module should do a lucky draw. One member should be selected for the prize(free car) 

and the member should be selected from those members who are registered and paid the 

monthly installment ,members based on unique Challa No. the details of the winner must be 

shown.


1
Expert's answer
2021-06-09T16:03:47-0400
#include<iostream>
#include<string>
#include<stdlib.h>
#include<time.h>
using namespace std;

class Registr{
   public:
   string name;
   string fname;
   long cnic;
   string contact;
   string addr;
   //using static to make it unique for each person
   static long chno;
   Registr operator++()
        {
        Registr temp;
        temp.name=name;
        temp.fname=fname;
        temp.cnic=cnic;
        temp.contact=contact;
        temp.addr=addr;
        chno++;
        return temp;
        }


    };

//intial challan no;
long Registr::chno=11234;

int monthlyInstallment(Registr user[],int size)
{
   Registr person;
   cout<<"Enter name: ";
   getline(cin,person.name);
   cout<<"Enter father's name: ";
   getline(cin,person.fname);
   cout<<"Enter cnic: ";
   cin>>person.cnic;
   cout<<"Enter contact no.: ";
   cin>>person.contact;
   cin.ignore();
   cout<<"Enter address: ";
   getline(cin,person.addr);
   //using increment operator to make sure value is unique every time
   cout<<"Your Unique Challan No. is: "<<Registr::chno++<<endl;

   user[size++]=person;

}

//show name and cnic of the person who won lottery
void lotteryWinner(Registr user[], int size)
{
   int winner = rand()%size;

   cout<<"\n\n LOTTERY WINNER\n\n";
   cout<<"WINNER IS: "<<user[winner].name<<endl;
   cout<<"CNIC OF WINNER: "<<user[winner].cnic<<endl;
}

int main()
{

   //sedding random
   srand(time(0));
   Registr user[10];
   int size=0;
   //taking user input
   size= monthlyInstallment(user,size);
   size= monthlyInstallment(user,size);
   size= monthlyInstallment(user,size);

   lotteryWinner(user,size);

   return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog