حل السؤال
حل السؤال 21
import 'dart:io';
void main () {
stdout.write('Enter the number of traffic mistakes: ');
int traffic = int.parse(stdin.readLineSync()!);
stdout.write('Enter the number of motor mistakes: ');
int motor = int.parse(stdin.readLineSync()!);
stdout.write('Enter the number of first aid mistakes: ');
int firstAid = int.parse(stdin.readLineSync()!);
double trafficScore = ((50 - traffic) / 50) * 100;
double motorScore = ((40 - motor) / 40) * 100;
double firstAidScore = ((30 - firstAid) / 30) * 100;
if (trafficScore >= 70 && motorScore >= 70 &&
firstAidScore >= 70) {
print('-----------------------------');
print('Traffic score: ${trafficScore.toStringAsFixed(2)}');
print('Motor score: ${motorScore.toStringAsFixed(2)}');
print('First aid score: ${firstAidScore.toStringAsFixed(2)}');
print('Congratulations, you are eligible for the driving test!');
} else {
print('-----------------------------');
print('Traffic score: ${trafficScore.toStringAsFixed(2)}');
print('Motor score: ${motorScore.toStringAsFixed(2)}');
print('First aid score: ${firstAidScore.toStringAsFixed(2)}');
print('Sorry, you are not eligible for the driving test.');
}
}

