<p>In file <b>C:\xampp\htdocs\eclass\include\action.php</b> on line <b>25</b> : <i>Unable to execute statement:"Table '.\eclass\actions_daily' is marked as crashed and should be repaired", sqlstate:"145", errornum:"HY000", 	statement:"SELECT id, TIME_TO_SEC(TIMEDIFF(NOW(), last_update)) AS diff, module_id                                                FROM actions_daily                                                WHERE user_id = ?                                                AND course_id = ?                                                AND day = DATE(NOW())                                                ORDER BY last_update DESC LIMIT 1", 	elapsed:0.003</i></p><p>In file <b>C:\xampp\htdocs\eclass\include\action.php</b> on line <b>50</b> : <i>Unable to execute statement:"Table '.\eclass\actions_daily' is marked as crashed and should be repaired", sqlstate:"145", errornum:"HY000", 	statement:"SELECT id                                    FROM actions_daily                                    WHERE user_id = ?                                    AND module_id = ?                                    AND course_id = ?                                    AND day = '2026-12-04'", 	elapsed:0.002</i></p><p>In file <b>C:\xampp\htdocs\eclass\include\action.php</b> on line <b>71</b> : <i>Unable to execute statement:"Table '.\eclass\actions_daily' is marked as crashed and should be repaired", sqlstate:"145", errornum:"HY000", 	statement:"INSERT INTO actions_daily SET                    user_id = ?,                    module_id = ?,                    course_id = ?,                    hits = 1,                    duration = 900,                    day = '2026-12-04'                     , last_update = NOW() ", 	elapsed:0.002</i></p>/* Program that calculates income tax based on the following rates: 
 * Income up to 20000 ==> 22%
 * Income greater than 20000 ==> 35%
 * Additional discounts: -1% if there are children, -0.5% for good credit.
 *
 * Author: V. Doufexi
 * Date: Oct. 19, 2016
 */

#include<stdio.h>

#define LIMIT 20000
#define LOW_RATE 0.22
#define HIGH_RATE 0.35
#define CHILD_DISCOUNT 0.01
#define CREDIT_DISCOUNT 0.05

int main (int argc, char *argv[]) {

	double income, init_tax, final_tax, discount_rate;
	char kids_exist, credit_ok;

	printf("Income (Euro): ");
	scanf("%lf", &income);
	printf("Any kids? (y/n): ");
	scanf(" %c", &kids_exist);
	printf("Paid tax for last year? (y/n): ");
	scanf(" %c", &credit_ok);
	
	if (kids_exist == 'y' && credit_ok == 'y') {
		discount_rate = CHILD_DISCOUNT + CREDIT_DISCOUNT;
	}
	else if (kids_exist == 'y' && credit_ok == 'n') { 
		discount_rate = CHILD_DISCOUNT;
	}
	else if (credit_ok == 'y') { 
		discount_rate = CREDIT_DISCOUNT;
	}
	else {
		discount_rate = 0;
	}

	if (income <= LIMIT) {
		init_tax = income * LOW_RATE;	
	}
	else {
		init_tax = LIMIT * LOW_RATE + (income - LIMIT)*HIGH_RATE ; 
	}
	final_tax = init_tax - init_tax*discount_rate;
	
	printf("\nIncome: %.2lf\n", income);
	printf("Tax: %.2lf\n", final_tax);

	return 0;
}
