Beispiel #1
0
	int update()
	{
		if (age <= RETIREMENT_AGE){
			stock += start_salary * pow(0.03, age);
		}
		payment();
		stock -= COMMODITY;
		if (stock < 0){
			die();
		}
		age++;
	}
Beispiel #2
0
void
do_10_pack ()
{
  int n;
  long start = get_msec_count (), duration;

  ta_enter (&ten_pack_ta);
  for (n = 0; n < 10; n++)
    {
      new_order ();
#ifndef NO_ONLY
      payment ();
#endif
    }

#ifndef NO_ONLY
  ta_enter (&delivery_ta);
  if (strstr (dbms, "Virtuoso") || strstr (dbms, "SOAP"))
    {
      for (n = 1; n <= 10; n++)
	delivery_1 (local_w_id, n);
    }
  else
    {
      delivery_1 (local_w_id, 0);
    }
  ta_leave (&delivery_ta);
  slevel ();
  ostat ();
#endif

  ta_leave (&ten_pack_ta);
  duration = get_msec_count () - start;
#if defined(GUI)
  log (1, "-- %ld tpmC\n", 600000 / duration);
#else
  printf ("-- %ld tpmC\n\n", 600000 / duration);
  fflush (stdout);
#endif
}
Beispiel #3
0
// start program
int main()


{  int password;


  int phonenumber;


  char choice;





//  system("cls");



  printf("\n\n\n\n\n\n\n\n\n\t\t*******************************************************");


  printf("\n\t\t      ---THE BILLING MANAGEMENT SYSTEM---");


  printf("\n\t\t*******************************************************");
  printf("\n\n\n\n\n\t---------------A project by Avdesh, Neha,  Nitish & Ankit-------------");


  Sleep(100);


  getch();


    //system("cls");


  while (1)


  {


    system("cls");


    printf("\n enter\n A : for adding new records.\n L : for list of records");


    printf("\n M : for modifying records.\n P : for payment");


    printf("\n S : for searching records.");


    printf("\n D : for deleting records.\n E : for exit\n");


    choice=getche();


    choice=toupper(choice);


    switch(choice)


    {


      case 'P':


        payment();break;


      case 'A':


        addrecords();break;


      case 'L':


        listrecords();break;


      case 'M':


        modifyrecords();break;


      case 'S':


        searchrecords();break;


      case 'D':


        deleterecords();
        remove("a.txt");
        rename("temp.txt","a.txt");
        break;


      case 'E':


        system("cls");


        printf("\n\n\t\t\t\tTHANK YOU");


        printf("\n\n\n\n\n:\n\tFOR USING OUR SERVICE");


        Sleep(2000);


        exit(0);


        break;


      default:


        system("cls");


        printf("Incorrect Input");


        printf("\nAny key to continue");


        getch();


    }


  }


}
Beispiel #4
0
/*
 * prepare data and execute payment transaction
 */
static int do_payment (int t_num)
{
    int c_num;
    int byname,i,ret;
    clock_t clk1,clk2;
    double rt;
    struct timespec tbuf1;
    struct timespec tbuf2;
    int  w_id, d_id, c_w_id, c_d_id, c_id, h_amount;
    char c_last[17];

    if(num_node==0){
	w_id = RandomNumber(1, num_ware);
    }else{
	c_num = ((num_node * t_num)/num_conn); /* drop moduls */
	w_id = RandomNumber(1 + (num_ware * c_num)/num_node,
			    (num_ware * (c_num + 1))/num_node);
    }
    d_id = RandomNumber(1, DIST_PER_WARE);
    c_id = NURand(1023, 1, CUST_PER_DIST); 
    Lastname(NURand(255,0,999), c_last); 
    h_amount = RandomNumber(1,5000);
    if (RandomNumber(1, 100) <= 60) {
        byname = 1; /* select by last name */
    }else{
        byname = 0; /* select by customer id */
    }
    if (RandomNumber(1, 100) <= 85) {
        c_w_id = w_id;
        c_d_id = d_id;
    }else{
        c_w_id = other_ware(w_id);
        c_d_id = RandomNumber(1, DIST_PER_WARE);
    }

    clk1 = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tbuf1 );
    for (i = 0; i < MAX_RETRY; i++) {
      ret = payment(t_num, w_id, d_id, byname, c_w_id, c_d_id, c_id, c_last, h_amount);
      clk2 = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tbuf2 );

      if(ret){

	rt = (double)(tbuf2.tv_sec * 1000.0 + tbuf2.tv_nsec/1000000.0-tbuf1.tv_sec * 1000.0 - tbuf1.tv_nsec/1000000.0);
	if(rt > max_rt[1])
	  max_rt[1]=rt;
	hist_inc(1, rt);
	if(counting_on){
	  if( rt < RTIME_PAYMENT ){
	    success[1]++;
	    success2[1][t_num]++;
	  }else{
	    late[1]++;
	    late2[1][t_num]++;
	  }
	}

	return (1); /* end */
      }else{

	if(counting_on){
	  retry[1]++;
	  retry2[1][t_num]++;
	}

      }
    }

    if(counting_on){
      retry[1]--;
      retry2[1][t_num]--;
      failure[1]++;
      failure2[1][t_num]++;
    }

    return (0);
}
Beispiel #5
0
void MainWindow::newPaymentSlot()
{
	Payment payment("", 0, "", mCostSplitter->getPersons(), QDate::currentDate());
	mCostSplitter->addPayment(payment);
}
Beispiel #6
0
void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, const std::string& strPaymentAmounts)
{
    // SPLIT UP ADDR/AMOUNT STRINGS AND PUT IN VECTORS

    std::vector<std::string> vecParsed1;
    std::vector<std::string> vecParsed2;
    vecParsed1 = SplitBy(strPaymentAddresses, "|");
    vecParsed2 = SplitBy(strPaymentAmounts, "|");

    // IF THESE DONT MATCH, SOMETHING IS WRONG

    if (vecParsed1.size() != vecParsed2.size()) {
        std::ostringstream ostr;
        ostr << "CSuperblock::ParsePaymentSchedule -- Mismatched payments and amounts";
        LogPrintf("%s\n", ostr.str());
        throw std::runtime_error(ostr.str());
    }

    if (vecParsed1.size() == 0) {
        std::ostringstream ostr;
        ostr << "CSuperblock::ParsePaymentSchedule -- Error no payments";
        LogPrintf("%s\n", ostr.str());
        throw std::runtime_error(ostr.str());
    }

    // LOOP THROUGH THE ADDRESSES/AMOUNTS AND CREATE PAYMENTS
    /*
      ADDRESSES = [ADDR1|2|3|4|5|6]
      AMOUNTS = [AMOUNT1|2|3|4|5|6]
    */

    for (int i = 0; i < (int)vecParsed1.size(); i++) {
        CBitcoinAddress address(vecParsed1[i]);
        if (!address.IsValid()) {
            std::ostringstream ostr;
            ostr << "CSuperblock::ParsePaymentSchedule -- Invalid Dash Address : " << vecParsed1[i];
            LogPrintf("%s\n", ostr.str());
            throw std::runtime_error(ostr.str());
        }
        /*
            TODO

            - There might be an issue with multisig in the coinbase on mainnet, we will add support for it in a future release.
            - Post 12.3+ (test multisig coinbase transaction)
        */
        if (address.IsScript()) {
            std::ostringstream ostr;
            ostr << "CSuperblock::ParsePaymentSchedule -- Script addresses are not supported yet : " << vecParsed1[i];
            LogPrintf("%s\n", ostr.str());
            throw std::runtime_error(ostr.str());
        }

        CAmount nAmount = ParsePaymentAmount(vecParsed2[i]);

        LogPrint("gobject", "CSuperblock::ParsePaymentSchedule -- i = %d, amount string = %s, nAmount = %lld\n", i, vecParsed2[i], nAmount);

        CGovernancePayment payment(address, nAmount);
        if (payment.IsValid()) {
            vecPayments.push_back(payment);
        } else {
            vecPayments.clear();
            std::ostringstream ostr;
            ostr << "CSuperblock::ParsePaymentSchedule -- Invalid payment found: address = " << address.ToString()
                 << ", amount = " << nAmount;
            LogPrintf("%s\n", ostr.str());
            throw std::runtime_error(ostr.str());
        }
    }
}