السلام عليكــم ورحمـة الله وبركاتــه
++ابي احول هذا الكود إلا كود ال
/* Main */
// variable declaration
double labWeight, hqWeight , firstExamWeight , secondWeight , finalWeight ,
AhmedTotal , MohammadTotal ,AliTotal, SamiTotal KareemTotal;
// take values from user keyboard :
labWeight = (from keyboard);
hqWeight = (from keyboard);
firstExamWeight = (from keyboard);
secondWeight = (from keyboard);
finalWeight = (from keyboard);
// take files from the file :
// Ahmed
AhmedTotal = (labWeight/100 .0) (from file) + (hqWeight/100 .0) (from file) + (firstExamWeight /100 .0) (fromfile) + (secondWeight /100 .0) (from file) +
(finalWeight /100 .0) (fromfile);
// Mohammad
MohammadTotal = (labWeight/100 .0) (from file) + (hqWeight/100 .0) (from file) + (firstExamWeight /100 .0) (fromfile) + (secondWeight /100 .0) (from file) +
(finalWeight /100 .0) (fromfile);
// Ali
AliTotal = (labWeight/100 .0) (from file) + (hqWeight/100 .0) (from file) + (firstExamWeight /100 .0) (fromfile) + (secondWeight /100 .0) (from file) +
(finalWeight /100 .0) (fromfile);
// Sami
SamiTotal = (labWeight/100 .0) (from file) + (hqWeight/100 .0) (from file) + (firstExamWeight /100 .0) (fromfile) + (secondWeight /100 .0) (from file) +
(finalWeight /100 .0) (fromfile);
// Kareem
KareemTotal = (labWeight/100 .0) (from file) + (hqWeight/100 .0) (from file) + (firstExamWeight /100 .0) (fromfile) + (secondWeight /100 .0) (from file) + (finalWeight /100 .0) (fromfile);
// Maximum Grade :
double max = AliTotal;
String maxName = “Ali”;
if(max < AhmedTotal){
max = AhmedTotal;
maxName = “Ahmed”;
}
else if (max < KareemTotal ){
max = KareemTotal;
maxName = “Kareem”;
}
else if (max < SamiTotal){
max = SamiTotal;
maxName = “Sami”;
}
else if (max < MohammadTotal){
max = MohammadTotal;
maxName = “Mohammad”;
}
print (“The Heighest Grade :” + maxName );
// call printStarsFunction (out of main)
Print Line (“Weighted Score Chart”);
printStarsFunction(“Ahmed” , AhmedTotal);
printStarsFunction(“Mohammad” MohammadTotal);
printStarsFunction(“Sami” , SamiTotal);
printStarsFunction(“Kareem” , KareemTotal);
printStarsFunction(“Ali” , AliTotal);
/* End of Main */
void printStarsFunction(String s , double grade){
print Line (s);
for(int i = 1; i<= grade; i++ ){
print(“*”);
}
printLine(“”);
}